16

I have a project in Gerrit and each time I submit a change I manually have to add a group of reviewers to that change. Is there a mechanism that would allow me to specify reviewers that I want to be emailed for each change?

Luuklag
  • 3,897
  • 11
  • 38
  • 57
Sriram Venkatesh
  • 593
  • 2
  • 8
  • 22

5 Answers5

21

You can use the %r=reviewer@mail.com syntax on your branch specifier during a push to automatically add reviewers to a change.

You can add as many emails as you want and all will be emailed, e.g.

git push tr:kernel/common HEAD:refs/for/experimental%r=a@a.com,r=b@b.com,cc=c@c.com

It’s a good idea to just specify this in a remote block in your git config so you don't have to type all that each time.

approxiblue
  • 6,982
  • 16
  • 51
  • 59
Motti Strom
  • 2,555
  • 1
  • 18
  • 15
  • [Here's script](https://github.com/sschuberth/dev-scripts/blob/master/gerrit/gerrit-push-for.sh) that uses this method, and it also suggests reviewers based on [git-contacts](https://github.com/git/git/blob/master/contrib/contacts/git-contacts) if it's installed. – sschuberth Mar 31 '14 at 08:25
  • Does this work with Gerrit Groups as well ? – Lucas Mendonca Jan 21 '22 at 10:15
2

If you happen to be using Gerrit with Repo, then you can always specify reviewers while uploading changes.

repo upload --re=address_of_reviewer1,address_of_reviewer2...,address_of_reviewerN
approxiblue
  • 6,982
  • 16
  • 51
  • 59
mrutyunjay
  • 6,850
  • 7
  • 25
  • 35
0

Sure, just type in the group name in the add reviewer box. If this isn't working, what version of Gerrit are you using?

Brad
  • 5,492
  • 23
  • 34
  • It is working but I want it to be automatic so the coders do not have to manually ad it each time there is a change because its always the same group of reviewers. – Sriram Venkatesh May 28 '13 at 03:29
  • There is nothing built-in to Gerrit to handle this. You need to use an external method - either a hook or a system watching the event stream (Jenkins) – Brad May 28 '13 at 15:45
  • There is a built-in way, it uses an augmented push branch syntax - see my answer http://stackoverflow.com/questions/16658879/gerrit-add-reviewers/16823898#16823898 – Motti Strom Nov 07 '13 at 03:12
0

You can use the gerrit hooks or use jenkins with the gerrit trigger to add the reviewers

uncletall
  • 6,609
  • 1
  • 27
  • 52
0

There are plugins for Gerrit which do exactly that:

maoizm
  • 682
  • 13
  • 17