Project

General

Profile

Gerrit » History » Version 9

neels, 05/14/2016 03:00 AM

1 1 zecke
h1. Contributing using Gerrit
2 1 zecke
3 1 zecke
Gerrit is a review tool that integrates nicely with git and ssh. Instead of manually uploading a change, one can push it for review. One can use ssh to trigger review and actions.
4 1 zecke
5 1 zecke
h2. Subprojects using Gerrit
6 1 zecke
7 1 zecke
The following projects use Gerrit to contribute changes:
8 1 zecke
9 1 zecke
* libosmocore.git
10 1 zecke
* libosmo-abis.git
11 1 zecke
* libosmo-netif.git
12 4 zecke
* libosmo-sccp.git
13 1 zecke
* libsmpp34.git
14 1 zecke
* openbsc.git
15 1 zecke
* osmo-bts.git
16 1 zecke
* osmo-iuh.git
17 1 zecke
* osmo-pcu.git
18 1 zecke
* cellmgr-ng.git
19 5 zecke
* osmo-sip-connector.git
20 1 zecke
 
21 1 zecke
h2. Configuring Gerrit/Account
22 1 zecke
23 1 zecke
You will need to sign-up at https://gerrit.osmocom.org/login/. If you have an Osmocom Redmine account you can use https://osmocom.org/openid as OpenID provider. After the initial sign-up you will need to:
24 1 zecke
25 1 zecke
* Pick a username (can not be changed)
26 1 zecke
* Add your public ssh key(s)
27 1 zecke
* Add email addresses you intend to use as author/comitter
28 1 zecke
29 1 zecke
h2. Setting up Gerrit for commits and pushing
30 1 zecke
31 2 zecke
* Add the remote to be able to fetch and push to gerrit
32 2 zecke
* Fetch the commit hook that adds Change-Id to each commit to uniquely identify a commit
33 2 zecke
34 2 zecke
<pre>
35 7 neels
USERNAME=gerrit_user_name
36 7 neels
PROJECT=$(basename $PWD)
37 7 neels
git remote add gerrit ssh://$USERNAME@gerrit.osmocom.org:29418/$PROJECT.git
38 7 neels
scp -P 29418 $USERNAME@gerrit.osmocom.org:hooks/commit-msg .git/hooks/
39 7 neels
</pre>
40 7 neels
41 7 neels
* In case your local username matches the gerrit username, the setup shortens to
42 7 neels
43 7 neels
<pre>
44 7 neels
PROJECT=$(basename $PWD)
45 7 neels
git remote add gerrit ssh://gerrit.osmocom.org:29418/$PROJECT.git
46 7 neels
scp -P 29418 gerrit.osmocom.org:hooks/commit-msg .git/hooks/
47 7 neels
</pre>
48 7 neels
49 7 neels
Then
50 7 neels
51 7 neels
* Push for review
52 7 neels
<pre>
53 7 neels
git push gerrit HEAD:refs/for/master
54 7 neels
</pre>
55 7 neels
56 7 neels
* Push a user branch
57 7 neels
<pre>
58 9 neels
git push gerrit HEAD:refs/heads/users/$USERNAME/topic
59 7 neels
</pre>
60 7 neels
61 7 neels
* Directly push to master if you are allowed to
62 7 neels
<pre>
63 7 neels
git push gerrit HEAD:refs/heads/master
64 7 neels
</pre>
65 7 neels
66 7 neels
* List changesets in gerrit
67 7 neels
<pre>
68 7 neels
git ls-remote gerrit changes/*
69 2 zecke
</pre>
Add picture from clipboard (Maximum size: 48.8 MB)