Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EGit/Contributor Guide"

(Contributing Patches)
Line 1: Line 1:
{{:DocumentationGuidelines/DraftHeader}}  
+
{{:DocumentationGuidelines/DraftHeader}} {{EGit}}  
{{EGit}}  
+
  
 
= Obtaining Sources  =
 
= Obtaining Sources  =
Line 7: Line 6:
  
 
From the command line:  
 
From the command line:  
<pre style="width: 40em">
+
<pre style="width: 40em;">git clone git://egit.eclipse.org/egit/parallelip-jgit.git jgit
git clone git://egit.eclipse.org/egit/parallelip-jgit.git jgit
+
 
git clone git://egit.eclipse.org/egit/parallelip-egit.git egit
 
git clone git://egit.eclipse.org/egit/parallelip-egit.git egit
</pre>
+
</pre>  
 +
From an installed EGit plugin:
  
From an installed EGit plugin:
+
*File &gt; Import &gt; Git Repository
* File &gt; Import &gt; Git Repository
+
*Enter URL
* Enter URL
+
<pre style="width: 40em;">git://egit.eclipse.org/egit/parallelip-jgit.git</pre>
<pre style="width: 40em">git://egit.eclipse.org/egit/parallelip-jgit.git</pre>
+
*Import projects
* Import projects
+
 
 +
*File &gt; Import &gt; Git Repository  
 +
*Enter URL
 +
<pre style="width: 40em;">git://egit.eclipse.org/egit/parallelip-egit.git</pre>  
 +
*Import projects  
 +
*Browse the repositories in [http://egit.eclipse.org/w/ gitweb]
 +
 
 +
= Build =
 +
 
 +
EGit and JGit builds run on build.eclipse.org using [http://docs.codehaus.org/display/M2ECLIPSE/Tycho+user+docs Tycho].
 +
 
 +
<pre style="width: 40em;">https://build.eclipse.org/hudson/job/cbi-jgit</pre>
 +
<pre style="width: 40em;">https://build.eclipse.org/hudson/job/cbi-egit</pre>
  
* File &gt; Import &gt; Git Repository
 
* Enter URL
 
<pre style="width: 40em">git://egit.eclipse.org/egit/parallelip-egit.git</pre>
 
* Import projects
 
* Browse the repositories in [http://egit.eclipse.org/w/ gitweb]
 
  
 
= Contributing Patches  =
 
= Contributing Patches  =
  
Review the following style guides:
+
Review the following style guides:  
* [http://egit.eclipse.org/w/?p=egit/parallelip-jgit.git;a=blob;f=SUBMITTING_PATCHES;hb=HEAD JGit SUBMITTING_PATCHES]
+
* [http://egit.eclipse.org/w/?p=egit/parallelip-egit.git;a=blob;f=SUBMITTING_PATCHES;hb=HEAD EGit SUBMITTING_PATCHES]
+
  
Currently the project is alpha-testing [http://code.google.com/p/gerrit/ Gerrit Code Review] for Git based patch submission and review.  To use the alpha testing instance hosted at eclipse.org:
+
*[http://egit.eclipse.org/w/?p=egit/parallelip-jgit.git;a=blob;f=SUBMITTING_PATCHES;hb=HEAD JGit SUBMITTING_PATCHES]
* [http://egit.eclipse.org/register Register a user account]
+
*[http://egit.eclipse.org/w/?p=egit/parallelip-egit.git;a=blob;f=SUBMITTING_PATCHES;hb=HEAD EGit SUBMITTING_PATCHES]
* Use ''Register New Email'' to register your email address with our Gerrit Code Review server.  This step is required to validate the address is correct.
+
* Add one or more public SSH keys
+
* Execute SSH once to accept the host key (or copy it from the registration web page)
+
<pre style="width: 60em">
+
ssh -p 29418 username@egit.eclipse.org
+
</pre>
+
* [http://egit.eclipse.org/r/#settings,new-agreement Confirm you agree] to the Eclipse.org Terms of Service by completing the Individual Contributor agreement.
+
* Upload your patch from Git to the target project:
+
** JGit
+
<pre style="width: 60em">
+
git push ssh://username@egit.eclipse.org:29418/egit/parallelip-jgit.git HEAD:refs/for/master
+
</pre>
+
** EGit
+
<pre style="width: 60em">
+
git push ssh://username@egit.eclipse.org:29418/egit/parallelip-egit.git HEAD:refs/for/master
+
</pre>
+
* Visit our [http://egit.eclipse.org/r/ Gerrit Code Review instance] to start reviewing
+
  
Or, create a [https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EGit new bug] and attach a Git formatted patch file, as produced by the `git format-patch` tool.
+
Currently the project is alpha-testing [http://code.google.com/p/gerrit/ Gerrit Code Review] for Git based patch submission and review. To use the alpha testing instance hosted at eclipse.org:
  
== Adding a remote ==
+
*[http://egit.eclipse.org/register Register a user account]
 +
*Use ''Register New Email'' to register your email address with our Gerrit Code Review server. This step is required to validate the address is correct.
 +
*Add one or more public SSH keys
 +
*Execute SSH once to accept the host key (or copy it from the registration web page)
 +
<pre style="width: 60em;">ssh -p 29418 username@egit.eclipse.org
 +
</pre>
 +
*[http://egit.eclipse.org/r/#settings,new-agreement Confirm you agree] to the Eclipse.org Terms of Service by completing the Individual Contributor agreement.
 +
*Upload your patch from Git to the target project:
 +
**JGit
 +
<pre style="width: 60em;">git push ssh://username@egit.eclipse.org:29418/egit/parallelip-jgit.git HEAD:refs/for/master
 +
</pre>
 +
**EGit
 +
<pre style="width: 60em;">git push ssh://username@egit.eclipse.org:29418/egit/parallelip-egit.git HEAD:refs/for/master
 +
</pre>
 +
*Visit our [http://egit.eclipse.org/r/ Gerrit Code Review instance] to start reviewing
  
Since git can have multiple remotes, you can define one to be used to refer to Gerrit to save typing. Inside a previously checked-out repository you can run:
+
Or, create a [https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EGit new bug] and attach a Git formatted patch file, as produced by the `git format-patch` tool.
  
<pre>
+
== Adding a remote  ==
cd path/to/jgit
+
 
 +
Since git can have multiple remotes, you can define one to be used to refer to Gerrit to save typing. Inside a previously checked-out repository you can run:
 +
<pre>cd path/to/jgit
 
git config remote.review.url ssh://username@egit.eclipse.org:29418/egit/parallelip-jgit.git
 
git config remote.review.url ssh://username@egit.eclipse.org:29418/egit/parallelip-jgit.git
 
git config remote.review.push HEAD:refs/for/master
 
git config remote.review.push HEAD:refs/for/master
Line 64: Line 67:
 
git config remote.review.url ssh://username@egit.eclipse.org:29418/egit/parallelip-egit.git
 
git config remote.review.url ssh://username@egit.eclipse.org:29418/egit/parallelip-egit.git
 
git config remote.review.push HEAD:refs/for/master
 
git config remote.review.push HEAD:refs/for/master
</pre>
+
</pre>  
 +
You can now submit review requests from either repository using:
 +
<pre>git push review
 +
</pre>
 +
== Sending patches by mail  ==
  
You can now submit review requests from either repository using:
+
Although sending patches by mail is the approved way of interacting with, and asking feedback from, the Git project, please don't send patches via [http://www.kernel.org/pub//software/scm/git/docs/git-send-email.html git send-email]. Instead, please use [http://www.kernel.org/pub/software/scm/git/docs/git-format-patch.html git format-patch] to generate the <code>mbox</code>, and then attach that to an item in bugzilla as per the above SUBMITTING_PATCHES guides.
  
<pre>
+
If you're sending a work-in-progress for a review, be aware that you can also attach work-in-progress (or RFC) items to Bugzilla; it's not just for finished patches.
git push review
+
</pre>
+
  
== Sending patches by mail ==
+
However, it's generally preferred that you send items which you want comments on via Gerrit as per [[#Adding_a_remote]], since Gerrit allows comments to be added in-line and allows the opportunity to send multiple versions of a patch after changes are made. Once a change has been submitted to Gerrit, you can then mail the developer mailing list with a request to review your change via URL or get Gerrit to send the mail on your behalf.
  
Although sending patches by mail is the approved way of interacting with, and asking feedback from, the Git project, please don't send patches via [http://www.kernel.org/pub//software/scm/git/docs/git-send-email.html git send-email]. Instead, please use [http://www.kernel.org/pub/software/scm/git/docs/git-format-patch.html git format-patch] to generate the <code>mbox</code>, and then attach that to an item in bugzilla as per the above SUBMITTING_PATCHES guides.
+
= Gerrit Code Review Cheatsheet  =
  
If you're sending a work-in-progress for a review, be aware that you can also attach work-in-progress (or RFC) items to Bugzilla; it's not just for finished patches.
+
== Install the commit-msg hook in your repository  ==
 +
<pre style="width: 60em;">scp -p -P 29418 username@egit.eclipse.org:hooks/commit-msg .git/hooks/
 +
</pre>
 +
'''Question''' What does this do? Why would you want a commit-msg hook?
  
However, it's generally preferred that you send items which you want comments on via Gerrit as per [[#Adding a remote]], since Gerrit allows comments to be added in-line and allows the opportunity to send multiple versions of a patch after changes are made. Once a change has been submitted to Gerrit, you can then mail the developer mailing list with a request to review your change via URL or get Gerrit to send the mail on your behalf.
+
== To create a new change ==
  
= Gerrit Code Review Cheatsheet =
+
*JGit
 +
<pre style="width: 60em;">git push ssh://username@egit.eclipse.org:29418/egit/parallelip-jgit.git HEAD:refs/for/master
 +
</pre>
 +
*EGit
 +
<pre style="width: 60em;">git push ssh://username@egit.eclipse.org:29418/egit/parallelip-egit.git HEAD:refs/for/master
 +
</pre>
 +
Or, if you've followed the instructions on [[#Adding_a_remote]] you can simply do:
 +
<pre style="width: 60em;">git push review
 +
</pre>
 +
Since the current repository has the right definition for 'review', you won't need to remember the canonical push URL
  
== Install the commit-msg hook in your repository ==
+
== To update an existing change with a new commit ==
<pre style="width: 60em">
+
<pre style="width: 60em;">git push ssh://username@egit.eclipse.org:29418/egit/parallelip-jgit.git HEAD:refs/for/master
scp -p -P 29418 username@egit.eclipse.org:hooks/commit-msg .git/hooks/
+
</pre>  
</pre>
+
This works because Gerrit links the new commit to the prior change based upon the Change-Id footer in the commit message. (This is automatically generated by the commit-msg hook you installed above.) If you refuse to use the commit-msg hook, or don't have a Change-Id footer, you should read the Gerrit documentation on [http://gerrit.googlecode.com/svn/documentation/2.0/user-changeid.html change-id lines] and [http://gerrit.googlecode.com/svn/documentation/2.0/user-upload.html#push_replace replacing changes].
<b>Question</b> What does this do? Why would you want a commit-msg hook?
+
  
== To create a new change ==
+
== To compare bulk diffs using Git ==
* JGit
+
<pre style="width: 60em">
+
git push ssh://username@egit.eclipse.org:29418/egit/parallelip-jgit.git HEAD:refs/for/master
+
</pre>
+
* EGit
+
<pre style="width: 60em">
+
git push ssh://username@egit.eclipse.org:29418/egit/parallelip-egit.git HEAD:refs/for/master
+
</pre>
+
 
+
Or, if you've followed the instructions on [[#Adding_a_remote]] you can simply do:
+
 
+
<pre style="width: 60em">
+
git push review
+
</pre>
+
 
+
Since the current repository has the right definition for 'review', you won't need to remember the canonical push URL
+
 
+
== To update an existing change with a new commit ==
+
<pre style="width: 60em">
+
git push ssh://username@egit.eclipse.org:29418/egit/parallelip-jgit.git HEAD:refs/for/master
+
</pre>
+
This works because Gerrit links the new commit to the prior change based upon the Change-Id footer in the commit message.  (This is automatically generated by the commit-msg hook you installed above.)  If you refuse to use the commit-msg hook, or don't have a Change-Id footer, you should read the Gerrit documentation on [http://gerrit.googlecode.com/svn/documentation/2.0/user-changeid.html change-id lines] and [http://gerrit.googlecode.com/svn/documentation/2.0/user-upload.html#push_replace replacing changes].
+
 
+
== To compare bulk diffs using Git ==
+
  
 
Since each Gerrit review patchset actually commits its own tree, you can pull out the trees and compare them.  
 
Since each Gerrit review patchset actually commits its own tree, you can pull out the trees and compare them.  
  
If you've got a large changeset, and you want to be able to do diffs between them via (command line) git instead of browsing on the web, then you can fetch the individual changes and then perform a diff. For example, [http://egit.eclipse.org/r/2 http://egit.eclipse.org/r/2] shows the 'download' section for each patchset. In this case, it looks like:
+
If you've got a large changeset, and you want to be able to do diffs between them via (command line) git instead of browsing on the web, then you can fetch the individual changes and then perform a diff. For example, [http://egit.eclipse.org/r/2 http://egit.eclipse.org/r/2] shows the 'download' section for each patchset. In this case, it looks like:  
  
* Patch Set 1 <code>git pull git://egit.eclipse.org/egit/parallelip-jgit refs/changes/02/2/1 (1d3331a91bd477d3f70cde9613576cf9688ac358)</code>
+
*Patch Set 1 <code>git pull git://egit.eclipse.org/egit/parallelip-jgit refs/changes/02/2/1 (1d3331a91bd477d3f70cde9613576cf9688ac358)</code>  
* Patch Set 2 <code>git pull git://egit.eclipse.org/egit/parallelip-jgit refs/changes/02/2/2 (13ab9a43d4d512963556a92e889b1204d32f8e68)</code>
+
*Patch Set 2 <code>git pull git://egit.eclipse.org/egit/parallelip-jgit refs/changes/02/2/2 (13ab9a43d4d512963556a92e889b1204d32f8e68)</code>  
* Patch Set 3 <code>git pull git://egit.eclipse.org/egit/parallelip-jgit refs/changes/02/2/3 (d14cc645655683ba3e30a35833fb2282142e898f)</code>
+
*Patch Set 3 <code>git pull git://egit.eclipse.org/egit/parallelip-jgit refs/changes/02/2/3 (d14cc645655683ba3e30a35833fb2282142e898f)</code>  
* Patch Set 4 <code>git pull git://egit.eclipse.org/egit/parallelip-jgit refs/changes/02/2/4 (43de8d385b614c72fd796e17da75d381f6e0cc25)</code>
+
*Patch Set 4 <code>git pull git://egit.eclipse.org/egit/parallelip-jgit refs/changes/02/2/4 (43de8d385b614c72fd796e17da75d381f6e0cc25)</code>
  
Performing a <code>git pull</code> will both get the bits and merge them into your tree, which won't do what you want for comparison. So, in order to get the bits (but not merge), you need to do a <code>git fetch</code> instead. Let's say we want to diff the last two patches against each other rather than reviewing the entire patchset again:
+
Performing a <code>git pull</code> will both get the bits and merge them into your tree, which won't do what you want for comparison. So, in order to get the bits (but not merge), you need to do a <code>git fetch</code> instead. Let's say we want to diff the last two patches against each other rather than reviewing the entire patchset again:  
 
+
<pre>git fetch git://egit.eclipse.org/egit/parallelip-jgit refs/changes/02/2/3
<pre>
+
git fetch git://egit.eclipse.org/egit/parallelip-jgit refs/changes/02/2/3
+
 
git fetch git://egit.eclipse.org/egit/parallelip-jgit refs/changes/02/2/4
 
git fetch git://egit.eclipse.org/egit/parallelip-jgit refs/changes/02/2/4
  
Line 132: Line 122:
  
 
# or git diff d14cc5 43de8d
 
# or git diff d14cc5 43de8d
</pre>
+
</pre>  
 +
If you're doing this from within an already checked out project, you can do <code>git fetch origin</code> (or any other remote name in <code>.git/config}</code>.
 +
 
 +
Git fetched data will stay around in your repository, but will be 'orphaned' if no references point to it. To clean up, you can run <code>git gc</code> or wait until this happens automatically.
 +
 
 +
== To approve a change  ==
  
If you're doing this from within an already checked out project, you can do <code>git fetch origin</code> (or any other remote name in <code>.git/config}</code>.
+
*Click on Publish Comments
 +
*Vote with the radio buttons
  
Git fetched data will stay around in your repository, but will be 'orphaned' if no references point to it. To clean up, you can run <code>git gc</code> or wait until this happens automatically.
+
== To add a reviewer  ==
  
== To approve a change ==
+
Once you've pushed your commit to Gerrit for review, you can go to the web page (http://egit.eclipse.org/r/) and see your changes. By clicking on the review, there's an option to add a reviewer by e-mail address; they'll then be sent a message indicating that they'd like your review on the item.
* Click on Publish Comments
+
* Vote with the radio buttons
+
  
== To add a reviewer ==
+
== Code Review  ==
  
Once you've pushed your commit to Gerrit for review, you can go to the web page (http://egit.eclipse.org/r/) and see your changes. By clicking on the review, there's an option to add a reviewer by e-mail address; they'll then be sent a message indicating that they'd like your review on the item.
+
The code review category indicates your opinion on the quality of the code, and how well it fits within the purpose of the existing surrounding code. A +2 vote from any committer is required before submission can occur. A -2 vote from any committer will block submission.  
  
== Code Review ==
+
== IP Review ==
The code review category indicates your opinion on the quality of the code, and how well it fits within the purpose of the existing surrounding code.  A +2 vote from any committer is required before submission can occur.  A -2 vote from any committer will block submission.
+
  
== IP Review ==
+
The IP review category indicates whether or not the change has been properly logged under the [http://www.eclipse.org/legal/EclipseLegalProcessPoster.pdf eclipse IP process]. Under that process, any committer should mark his/her change +1 if they were the sole author of the change. For any other change, a committer should only mark +1 after ensuring the corresponding bug in Bugzilla has been updated with the iplog flag, or the corresponding CQ has been marked checkintocvs. For contributions from external contributors have a look at [http://www.eclipse.org/dsdp/tm/development/committer_howto.php#external_contrib the detailed rules]. A +1 vote is required to submit a change, while a -1 vote will block submission.  
The IP review category indicates whether or not the change has been properly logged under the [http://www.eclipse.org/legal/EclipseLegalProcessPoster.pdf eclipse IP process]. Under that process, any committer should mark his/her change +1 if they were the sole author of the change. For any other change, a committer should only mark +1 after ensuring the corresponding bug in Bugzilla has been updated with the iplog flag, or the corresponding CQ has been marked checkintocvs. For contributions from external contributors have a look at [http://www.eclipse.org/dsdp/tm/development/committer_howto.php#external_contrib the detailed rules]. A +1 vote is required to submit a change, while a -1 vote will block submission.
+
  
= Libraries from Orbit =
+
= Libraries from Orbit =
  
''com.jcraft.jsch''
+
''com.jcraft.jsch''  
  
* File &gt; Import &gt; CVS &gt; Projects from CVS
+
*File &gt; Import &gt; CVS &gt; Projects from CVS  
* Select URL ''':pserver:anonymous@dev.eclipse.org/cvsroot/tools'''
+
*Select URL ''':pserver:anonymous@dev.eclipse.org/cvsroot/tools'''  
* Use module '''org.eclipse.orbit/com.jcraft.jsch'''
+
*Use module '''org.eclipse.orbit/com.jcraft.jsch'''  
* Finish
+
*Finish  
* Right click on the project &gt; Team &gt; Switch to another branch
+
*Right click on the project &gt; Team &gt; Switch to another branch  
* Select tag from following list
+
*Select tag from following list  
* Refresh Tags
+
*Refresh Tags  
* Branches &gt; v0_1_41
+
*Branches &gt; v0_1_41
  
''org.kohsuke.args4j''
+
''org.kohsuke.args4j''  
  
* File &gt; Import &gt; CVS &gt; Projects from CVS
+
*File &gt; Import &gt; CVS &gt; Projects from CVS  
* Select URL ''':pserver:anonymous@dev.eclipse.org/cvsroot/tools'''
+
*Select URL ''':pserver:anonymous@dev.eclipse.org/cvsroot/tools'''  
* Use module '''org.eclipse.orbit/org.kohsuke.args4j'''
+
*Use module '''org.eclipse.orbit/org.kohsuke.args4j'''  
* Finish
+
*Finish  
* Right click on the project &gt; Team &gt; Switch to another branch
+
*Right click on the project &gt; Team &gt; Switch to another branch  
* Select tag from following list
+
*Select tag from following list  
* Refresh Tags
+
*Refresh Tags  
* Branches &gt; v2_0_12
+
*Branches &gt; v2_0_12
  
''javax.servlet''
+
''javax.servlet''  
  
* File &gt; Import &gt; CVS &gt; Projects from CVS
+
*File &gt; Import &gt; CVS &gt; Projects from CVS  
* Select URL ''':pserver:anonymous@dev.eclipse.org/cvsroot/tools'''
+
*Select URL ''':pserver:anonymous@dev.eclipse.org/cvsroot/tools'''  
* Use module '''org.eclipse.orbit/javax.servlet'''
+
*Use module '''org.eclipse.orbit/javax.servlet'''  
* Finish
+
*Finish  
* Right click on the project &gt; Team &gt; Switch to another branch
+
*Right click on the project &gt; Team &gt; Switch to another branch  
* Select tag from following list
+
*Select tag from following list  
* Refresh Tags
+
*Refresh Tags  
* Branches &gt; v2_5_0
+
*Branches &gt; v2_5_0
  
[[Category:Draft Documentation]]
+
[[Category:Draft_Documentation]]

Revision as of 11:38, 22 December 2009

Warning2.png
Draft Content
This page is currently under construction. Community members are encouraged to maintain the page, and make sure the information is accurate.
EGit
Website
Download
Community
Mailing ListForumsIRCmattermost
Issues
OpenHelp WantedBug Day
Contribute
Browse SourceProject Set File

Obtaining Sources

EGit and JGit are currently self hosted in Git. To obtain a copy of each repository:

From the command line:

git clone git://egit.eclipse.org/egit/parallelip-jgit.git jgit
git clone git://egit.eclipse.org/egit/parallelip-egit.git egit

From an installed EGit plugin:

  • File > Import > Git Repository
  • Enter URL
git://egit.eclipse.org/egit/parallelip-jgit.git
  • Import projects
  • File > Import > Git Repository
  • Enter URL
git://egit.eclipse.org/egit/parallelip-egit.git
  • Import projects
  • Browse the repositories in gitweb

Build

EGit and JGit builds run on build.eclipse.org using Tycho.

https://build.eclipse.org/hudson/job/cbi-jgit
https://build.eclipse.org/hudson/job/cbi-egit


Contributing Patches

Review the following style guides:

Currently the project is alpha-testing Gerrit Code Review for Git based patch submission and review. To use the alpha testing instance hosted at eclipse.org:

  • Register a user account
  • Use Register New Email to register your email address with our Gerrit Code Review server. This step is required to validate the address is correct.
  • Add one or more public SSH keys
  • Execute SSH once to accept the host key (or copy it from the registration web page)
ssh -p 29418 username@egit.eclipse.org
  • Confirm you agree to the Eclipse.org Terms of Service by completing the Individual Contributor agreement.
  • Upload your patch from Git to the target project:
    • JGit
git push ssh://username@egit.eclipse.org:29418/egit/parallelip-jgit.git HEAD:refs/for/master
    • EGit
git push ssh://username@egit.eclipse.org:29418/egit/parallelip-egit.git HEAD:refs/for/master

Or, create a new bug and attach a Git formatted patch file, as produced by the `git format-patch` tool.

Adding a remote

Since git can have multiple remotes, you can define one to be used to refer to Gerrit to save typing. Inside a previously checked-out repository you can run:

cd path/to/jgit
git config remote.review.url ssh://username@egit.eclipse.org:29418/egit/parallelip-jgit.git
git config remote.review.push HEAD:refs/for/master

cd path/to/egit 
git config remote.review.url ssh://username@egit.eclipse.org:29418/egit/parallelip-egit.git
git config remote.review.push HEAD:refs/for/master

You can now submit review requests from either repository using:

git push review

Sending patches by mail

Although sending patches by mail is the approved way of interacting with, and asking feedback from, the Git project, please don't send patches via git send-email. Instead, please use git format-patch to generate the mbox, and then attach that to an item in bugzilla as per the above SUBMITTING_PATCHES guides.

If you're sending a work-in-progress for a review, be aware that you can also attach work-in-progress (or RFC) items to Bugzilla; it's not just for finished patches.

However, it's generally preferred that you send items which you want comments on via Gerrit as per #Adding_a_remote, since Gerrit allows comments to be added in-line and allows the opportunity to send multiple versions of a patch after changes are made. Once a change has been submitted to Gerrit, you can then mail the developer mailing list with a request to review your change via URL or get Gerrit to send the mail on your behalf.

Gerrit Code Review Cheatsheet

Install the commit-msg hook in your repository

scp -p -P 29418 username@egit.eclipse.org:hooks/commit-msg .git/hooks/

Question What does this do? Why would you want a commit-msg hook?

To create a new change

  • JGit
git push ssh://username@egit.eclipse.org:29418/egit/parallelip-jgit.git HEAD:refs/for/master
  • EGit
git push ssh://username@egit.eclipse.org:29418/egit/parallelip-egit.git HEAD:refs/for/master

Or, if you've followed the instructions on #Adding_a_remote you can simply do:

git push review

Since the current repository has the right definition for 'review', you won't need to remember the canonical push URL

To update an existing change with a new commit

git push ssh://username@egit.eclipse.org:29418/egit/parallelip-jgit.git HEAD:refs/for/master

This works because Gerrit links the new commit to the prior change based upon the Change-Id footer in the commit message. (This is automatically generated by the commit-msg hook you installed above.) If you refuse to use the commit-msg hook, or don't have a Change-Id footer, you should read the Gerrit documentation on change-id lines and replacing changes.

To compare bulk diffs using Git

Since each Gerrit review patchset actually commits its own tree, you can pull out the trees and compare them.

If you've got a large changeset, and you want to be able to do diffs between them via (command line) git instead of browsing on the web, then you can fetch the individual changes and then perform a diff. For example, http://egit.eclipse.org/r/2 shows the 'download' section for each patchset. In this case, it looks like:

Performing a git pull will both get the bits and merge them into your tree, which won't do what you want for comparison. So, in order to get the bits (but not merge), you need to do a git fetch instead. Let's say we want to diff the last two patches against each other rather than reviewing the entire patchset again:

git fetch git://egit.eclipse.org/egit/parallelip-jgit refs/changes/02/2/3
git fetch git://egit.eclipse.org/egit/parallelip-jgit refs/changes/02/2/4

git diff d14cc645655683ba3e30a35833fb2282142e898f 43de8d385b614c72fd796e17da75d381f6e0cc25

# or git diff d14cc5 43de8d

If you're doing this from within an already checked out project, you can do git fetch origin (or any other remote name in .git/config}.

Git fetched data will stay around in your repository, but will be 'orphaned' if no references point to it. To clean up, you can run git gc or wait until this happens automatically.

To approve a change

  • Click on Publish Comments
  • Vote with the radio buttons

To add a reviewer

Once you've pushed your commit to Gerrit for review, you can go to the web page (http://egit.eclipse.org/r/) and see your changes. By clicking on the review, there's an option to add a reviewer by e-mail address; they'll then be sent a message indicating that they'd like your review on the item.

Code Review

The code review category indicates your opinion on the quality of the code, and how well it fits within the purpose of the existing surrounding code. A +2 vote from any committer is required before submission can occur. A -2 vote from any committer will block submission.

IP Review

The IP review category indicates whether or not the change has been properly logged under the eclipse IP process. Under that process, any committer should mark his/her change +1 if they were the sole author of the change. For any other change, a committer should only mark +1 after ensuring the corresponding bug in Bugzilla has been updated with the iplog flag, or the corresponding CQ has been marked checkintocvs. For contributions from external contributors have a look at the detailed rules. A +1 vote is required to submit a change, while a -1 vote will block submission.

Libraries from Orbit

com.jcraft.jsch

  • File > Import > CVS > Projects from CVS
  • Select URL :pserver:anonymous@dev.eclipse.org/cvsroot/tools
  • Use module org.eclipse.orbit/com.jcraft.jsch
  • Finish
  • Right click on the project > Team > Switch to another branch
  • Select tag from following list
  • Refresh Tags
  • Branches > v0_1_41

org.kohsuke.args4j

  • File > Import > CVS > Projects from CVS
  • Select URL :pserver:anonymous@dev.eclipse.org/cvsroot/tools
  • Use module org.eclipse.orbit/org.kohsuke.args4j
  • Finish
  • Right click on the project > Team > Switch to another branch
  • Select tag from following list
  • Refresh Tags
  • Branches > v2_0_12

javax.servlet

  • File > Import > CVS > Projects from CVS
  • Select URL :pserver:anonymous@dev.eclipse.org/cvsroot/tools
  • Use module org.eclipse.orbit/javax.servlet
  • Finish
  • Right click on the project > Team > Switch to another branch
  • Select tag from following list
  • Refresh Tags
  • Branches > v2_5_0

Back to the top