All actual code modifications happen on GitHub, discussion happens on GitHub *and* Gerrit (synced 2 way), and final merging happens in Gerrit. It does not require that new contributors who wish to contribute via GitHub have a Gerrit account. Also does not require git-review.
As of 2013 it is enabled in the following repositories:
It is a bot that does the following:
- Watch for new pull requests in GitHub.
- When a new PR comes in, opens an equivalent Gerrit patchset, and leaves a comment on the GitHub PR.
- If there are multiple commits in the GH PR, they are all squashed into one.
- Commit message is combination of title, description & commit messages of all commits in PR.
- There's a link in the commit message to original PR.
- Author information is preserved (hopefully only one person pushes to a PR).
- Committer is the bot account.
- Whenever there is a comment on either GH or Gerrit, it is synced to the other.
- Inline comments go to their appropriate inline places.
- PR comments become patchset comments, and vice versa.
- V, C changes in Gerrit leave a text comment on GH.
- When new commits are added to a PR, the appropriate Gerrit patchset is modified.
- When a Gerrit Patchset is modified, the appropriate PR doesn't get anything added. We might even decide to invalidate the PR when this happens. Reason being in Gerrit everything is squashed so there's no way to just push a single new commit to the PR.
- Abandon / Merge in Gerrit does the same in GitHub, but *not* vice versa.
This should be implemented as a bunch of python scripts running on labs. A special purpose account should be created on both GH and Gerrit for the bot. It'll probably just use polling, but GH's post receive webhooks might be useful here. Gerrit might have a similar mechanism too - we could perhaps integrate this the same way Jenkins is integrated.
Alternative is to write a Gerrit plugin, but it has the disadvantage of being GWT/Java, and the advantage of producing simpler looking boxes when represented by an UML diagram.
An approach that combines both might also be possible. Need more research to find the simplest approach that could possibly work.
- GH PR modifications watcher
- GH PR -> Gerrit Patchset committer
- Gerrit Patchset comments -> GH PR comments
- Gerrit Inline comments -> GH Inline Comments
- GH PR comments -> Gerrit Patchset comments
- GH Inline Comments -> Gerrit Inline comments
- Gerrit Abandon / Merge -> GH close pull request
Trying to get all of this done at once will end in disaster, so let's get it done bit by bit
- Create gerrit bot account, GH bot account, setup keys on labs Done
- GH PR watcher Done
- GH PR -> Gerrit Patchset Commiter (only initial request - manual trigger) Done
By the end of this, the bot can pick up brand new PRs and create equivalent Gerrit patchsets. It's okay to have this manually trigger.
- GH PR -> Gerrit Patchset Updater (when new commit is added - automatic trigger) Done
- Automatic trigger for initial GH PR -> Gerrit Patchset committer Done
New commits added to a GH PR should automatically update patchset.
- Gerrit Patchset Comment -> GH PR Comment (Automatic) Done
- Gerrit Merge / Abandon -> GH PR Merge / Abandon Done
This brings partial one way discussions sync from Gerrit to GitHub. Also automatic.
- Gerrit Inline Comment -> GH inline Comment
This completes the Gerrit -> GH discussion sync.
- GH PR Comments -> Gerrit Patchset comments
- GH Close -> Gerrit abandon
- GH Inline Comments -> Gerrit Inline Comments
This completes GH <-> Gerrit two way sync
Absolutely no clue. I don't think the iterations are equal length either - they are merely logically grouped bundles of work. I hope to get at least a good chunk of this done before end of April 2013, however - I'll be afk all of May.