Skip to content

[archived] Gerrit

Matthieu Baerts edited this page Jul 14, 2019 · 2 revisions

Note: Now that the new architecture code has been added in our repo, we are back to the patches sent via e-mails, with short iterations.

Why not continuing to only use e-mails?

The idea of using a web service like Gerrit would be to help sharing and reviewing patches-set, especially long ones, the ones that takes time before being merged and the ones that need a lot of back-and-forth. That's typically what we have in this kind of projects when new "features" need to be developed. It is less needed for projects in maintenance phases (like the current MPTCP version).

Of course, it is still possible to propose Change by using git send-email if needed.

Why Gerrit?

Gerrit is quite popular and it is possible to have a free service mirroring changes on the existing Github repo thanks to gerrithub.io. It is possible to quickly see all discussions related to the same patch having different versions, see only the differences between any versions of the same patch, add different rules to avoid Git manipulation errors but mainly, it is easy to use when everything is setup:

git checkout -b <MY_BRANCH> origin/for-review
git commit -s
git review     ## instead of 'git send-email'

Setup Gerrit

There are two actions to do once: setup GerritHub and setup your local Git repo

GerritHub

You can setup your account on GerritHub using your Github account: https://gerrithub.io/login/

  • DEFAULT access if you want to do some code contributions
  • (or Reviewer if you want to start by reviewing existing proposition of code but it is preferred to have the 'default' account)

Local Git Repo

In short:

GITHUB_NICKNAME=<TODO>
git clone ssh://${GITHUB_NICKNAME}@review.gerrithub.io:29418/multipath-tcp/mptcp_net-next && scp -p -P 29418 ${GITHUB_NICKNAME}@review.gerrithub.io:hooks/commit-msg mptcp_net-next/.git/hooks/
cd mptcp_net-next
git config --local --add gitreview.username ${GITHUB_NICKNAME}
cat <<EOF > .gitreview
[gerrit]
host=review.gerrithub.io
port=29418
project=multipath-tcp/mptcp_net-next
defaultbranch=for-review
EOF
# sudo pip install git-review ## or check https://www.mediawiki.org/wiki/Gerrit/git-review

For more details about that, please see: Gerrit: setup with explanations

Getting the notifications

You will automatically receive notifications when you are involved in a Change (as a reviewer, if you are in cc, etc.). But you can also ask to be notified when any new Changes are created for our project by going to: https://review.gerrithub.io/settings/#Notifications

  • multipath-tcp/mptcp_net-next is the project name
  • then click at least on Changes).

Typical use-cases / workflow

The workflow is basically the same as before but instead of using git send-email, git review will be used.

git checkout -b my_branch for-review
(...)                 # work here
git add -u <...>
git commit -sm "foo"  # Change-Id has been added automatically in the commit message
(...)                 # create more commits if needed
git review for-review # new Change created with target branch: 'for-review'

For more use cases, example, please see: Gerrit: use cases