Exclude author from gerrit review

I found a very easy answer in this google group: groups.google.com/disable-self-review

In a parent project (default is the All-Projects project) add this to the project.config file in refs/meta/config branch:

[access "refs/*"]
label-Code-Review = block -2..+2 group Change Owner

and in the groups file in the same branch add this line

global:Change-Owner Change Owner

Then take the statement that allows the right into the child project's project.config:

label-Code-Review = -2..+2 group Developers

Make sure to do write the block statement in the parent project and give the rights in the child project. If allow and block are in the same file the allow will overrule (See this). This will block the owner of a change to give -2 or +2. It will leave the -1 and +1 options intact. You can add a similar statement for any other custom labels you might use.


I'm not sure that this what you are looking for but it might give you some inspiration. According to this discussion the following fragment approves changes only if the reviewer and the change owner are not the same person.

  % If a reviewer approved the change, its OK.
  submit_rule(submit(CR)) :-
    change_owner(Owner),
    max_with_block('Code-Review', -2, 2, ok(Reviewer)),
    not_same(Owner, Reviewer),
    CR = label('Code-Review', ok(Reviewer)),
    !.

Tags:

Prolog

Gerrit