ReceiveCommits: Add support for approvals

Add -l option to magic branch to pass approvals through git push.

One use case is to support Work In Progress (WIP) Workflow backed by
WIP label. In this scenario new label is introduced with (-1,0) range
to mark a change as WIP. This change allows to optionally mark a new
patch set as WIP through `git push`.

With configuration of push macro in .git/config:
  git config remote.wip.url ssh://review.example.com:29418/project
  git config remote.wip.push HEAD:refs/for/master%l=wip-1

WIP patch set can be uploaded with:
  git push wip

Another use case is to do %l=Verified+1 if a change was compiled and
tested locally, e.g.:

  git config alias r '! buck build gerrit && buck test --all && \\
  git push gerrit-review HEAD:refs/for/master%l=Verified+1'

Then all these can be done in one step - compile, run tests and push to
review:

  git r

Change-Id: I52a67993952f32f8a04d9c0226f1c456a6f522b4
This commit is contained in:
David Ostrovsky
2014-05-01 19:33:36 +02:00
committed by Shawn Pearce
parent 438e99402e
commit 913cc07299
5 changed files with 145 additions and 4 deletions

View File

@@ -54,7 +54,6 @@ import org.kohsuke.args4j.spi.OptionHandler;
import org.kohsuke.args4j.spi.Setter;
import org.kohsuke.args4j.spi.FieldSetter;
import java.io.StringWriter;
import java.io.Writer;
import java.lang.annotation.Annotation;
@@ -443,4 +442,8 @@ public class CmdLineParser {
return false;
}
}
public CmdLineException reject(String message) {
return new CmdLineException(parser, message);
}
}