ITK/Gerrit: Difference between revisions

From KitwarePublic
< ITK
Jump to navigationJump to search
(Added details about editing commits)
(Replaced content with "This page previously contained information on use of Gerrit for ITK. The old information has been removed to avoid confusion. Please get started here instead.")
 
Line 1: Line 1:
'''Code Review System'''
This page previously contained information on use of Gerrit for ITK.
 
The old information has been removed to avoid confusion.
= Overview =
Please [[ITK/Git|get started here]] instead.
 
* Gerrit is a system for code reviews
* http://code.google.com/p/gerrit/
* It has a built-in Git implementation
 
= Installation =
 
The ITK Gerrit system is available at
 
* http://review.source.kitware.com
* http://review.source.kitware.com/p/ITK
 
In order to register you need to [http://openid.net/get-an-openid/ get an OpenID]
 
= Workflow =
 
[[image:ITK-Git-Gerrit-Stage-Workflow-A.png|529px]]
 
* [[ITK_Release_4/Migration Plan/Phases|Phases]]
 
== Workflow Example, from Android ==
 
* http://source.android.com/source/life-of-a-patch.html
 
= Integration with Git =
 
== Add Gerrit as one of your remotes ==
 
You will want to add Gerrit as a remote, using the username you selected in the Gerrit web interface,
 
  git remote add gerrit USERNAME@review.source.kitware.com:ITK
 
Gerrit allows you to select a username, and to upload your public SSH key(s).
 
== How to push to Gerrit ==
 
When on your topic branch, to view the commits that will be pushed as changes,
 
  git fetch gerrit
  git log gerrit/master..
 
Then, when you have a topic branch ready to go,
 
  git push gerrit HEAD:refs/for/master/topic-name
 
(Note: this could be simply
  git gerrit-push
if you have run SetupForDevelopment.sh)
 
Each of the commits listed by git log will then show up as a commit, optionally labeled with topic-name, in the Gerrit web interface. These commits can then be reviewed and integrated.
 
== Making Changes in Uploaded Patches (most recent commit) ==
 
If your change requires revision before it is accepted, you will first need to correct the commit in the topic branch. To do this:
 
  git add
 
any files that have changed. Then to add these changes to the most recent commit,
 
  git commit --amend
 
An editor will open. You can edit the commit message if necessary. Then
 
  git gerrit-push
 
This updated patch will be shown in the interface as patch set 2, any subsequent commits in the topic should also be updated with their new parents being the updated commits. If you need to update anything but the last commit in a topic you will need to use the approach detailed below.
 
== Making Changes in Uploaded Patches (multiple commits) ==
 
If your change requires revision before it is accepted, you will first need to correct the commit in the topic branch. The change-id should have been automatically added to your commits, or you can manually add it after the fact if necessary. If you need to edit the second most recent commit in a topic,
 
  git rebase -i HEAD~2
 
An editor will open, see [http://book.git-scm.com/4_interactive_rebasing.html here for details on interactive rebasing]. Once you have edited the relevant commit(s) you should be ready to upload the updated patches, assuming your commit messages all have the last line,
 
  Change-Id:[change id from Gerrit here]
 
You can then push the corrected commit(s) to Gerrit,,
 
  git gerrit-push
 
This updated patch will be shown in the interface as patch set 2, any subsequent commits in the topic should also be updated with their new parents being the updated commits. If you need to edit the third most recent commit simply use HEAD~3, or HEAD~4 to go four commits back.
 
= Gerrit Reviewers =
 
* [[ITK/Gerrit/Reviewers|Gerrit Reviewers]]

Latest revision as of 17:30, 3 June 2011

This page previously contained information on use of Gerrit for ITK. The old information has been removed to avoid confusion. Please get started here instead.