2 title: Working with Gerrit
5 Follow these instructions to collaborate on AGL through the Gerrit review system.
7 Please be sure that you are subscribed to the [mailing
8 list](https://lists.automotivelinux.org/g/agl-dev-community) and of
9 course, you can reach out on IRC at the #automotive channel on
12 Gerrit assigns the following roles to users:
14 - **Submitters**: May submit changes for consideration, review other
15 code changes, and make recommendations for acceptance or rejection by
16 voting +1 or -1, respectively.
17 - **Maintainers**: May approve or reject changes based upon feedback
18 from reviewers voting +2 or -2, respectively.
20 ## Getting deeper into Gerrit
22 A comprehensive walk-through of Gerrit is beyond the scope of this
23 document. There are plenty of resources available on the Internet. A good
25 [here](https://www.mediawiki.org/wiki/Gerrit/Tutorial) and
26 [Basic Gerrit Walkthrough for GitHub Users](https://gerrit-review.googlesource.com/Documentation/intro-gerrit-walkthrough-github.html).
28 ## Working with a local clone of the repository
30 To work on something, whether a new feature or a bugfix:
32 1. Open the Gerrit [repo page](https://gerrit.automotivelinux.org/gerrit/admin/repos/).
34 2. Select the repository you wish to work on.
36 3. Open a terminal window and clone the project locally using the
37 ``Clone with git hook`` URL. Be sure that ``ssh`` is also selected,
38 as this will make authentication much simpler. For example, for `documentation` repository:
41 $ git clone "ssh://<LFID>@gerrit.automotivelinux.org:29418/AGL/documentation" && scp -p -P
42 29418 <LFID>@gerrit.automotivelinux.org:hooks/commit-msg "documentation/.git/hooks/"
45 4. Setup `user` and `email` for git config
49 $ git.config --global user.name "Your Full Name"
50 $ git config --global user.email "your@email.com"
53 **NOTE:** To only configure for a particular repository :
57 $ git.config user.name "Your Full Name"
58 $ git config user.email "your@email.com"
61 5. Create a descriptively-named branch off of your cloned repository
64 $ git checkout -b issue-nname
69 There's a **very** useful tool for working with Gerrit called [git-review](https://www.mediawiki.org/wiki/Gerrit/git-review). This command-line tool can automate most of the ensuing sections for you. Ofcourse, reading the information below is also highly recommended so that you understand what's going on behind the scenes.
72 # for first time use only
75 If `.gitreview` is missing, add the following section to ``.git/config``, and replace ``<LFID>``
80 url = ssh://<LFID>@gerrit.automotivelinux.org:29418/AGL/documentation.git
81 fetch = +refs/heads/*:refs/remotes/gerrit/*
84 Then submit your change with ``git review``.
91 When you update your patch, you can commit with ``git commit --amend``,
92 and then repeat the ``git review`` command.
94 ## Typical Review Workflow
99 $ cd documentation # Working Repository
100 $ git remote -v update # Updating wrt remote
101 $ git checkout -b mytopicbranch origin/master # Creating new branch
103 $ git add <file> # Track the changed files
104 $ git commit -s # Signed Commit Message
105 $ git review # Submit Changes to review
108 - Updating existing Gerrit Review
111 $ cd documentation # Working Repository
112 $ git review -d 25678 # Download review, 25678 is change number
114 $ git add <file> # Track the changed files
115 $ git commit -s # Signed Commit Message
116 $ git review # Submit Changes to review
117 $ git checkout master # Return to master branch
120 ## Reviewing Using Gerrit
122 - **Add**: This button allows the change submitter to manually add
123 names of people who should review a change; start typing a name and
124 the system will auto-complete based on the list of people registered
125 and with access to the system. They will be notified by email that
126 you are requesting their input.
128 - **Abandon**: This button is available to the submitter only; it
129 allows a committer to abandon a change and remove it from the merge
132 - **Change-ID**: This ID is generated by Gerrit (or system). It becomes
133 useful when the review process determines that your commit(s) have to
134 be amended. You may submit a new version; and if the same Change-ID
135 header (and value) are present, Gerrit will remember it and present
136 it as another version of the same change.
138 - **Status**: Currently, the example change is in review status, as
139 indicated by “Needs Verified” in the upper-left corner. The list of
140 Reviewers will all emit their opinion, voting +1 if they agree to the
141 merge, -1 if they disagree. Gerrit users with a Maintainer role can
142 agree to the merge or refuse it by voting +2 or -2 respectively.
144 Notifications are sent to the email address in your commit message's
145 Signed-off-by line. Visit your [Gerrit dashboard](https://gerrit.automotivelinux.org/gerrit/dashboard/self),
146 to check the progress of your requests.
148 The history tab in Gerrit will show you the in-line comments and the author of the review.