Add the --strict-labels option to SSH review command

This has been in the REST API since it was created but never added to
the SSH command interface. Add it so that systems using SSH can control
strictness behavior.

Change-Id: I52b8ec30c89b6ad1eefe065c1e156a6e7a7109d0
This commit is contained in:
Nasser Grainawi 2015-11-11 16:29:38 -08:00 committed by David Pursehouse
parent 2c57f99fde
commit b86ae4951f
2 changed files with 11 additions and 1 deletions

View File

@ -128,6 +128,12 @@ branch.
or invalid value) and votes that are not permitted for the user are
silently ignored.
--strict-labels::
Require ability to vote on all specified labels before reviewing change.
If the vote is invalid (invalid label or invalid name), the vote is not
permitted for the user, or the vote is on an outdated or closed patch set,
return an error instead of silently discarding the vote.
== ACCESS
Any user who has configured an SSH key.

View File

@ -122,6 +122,10 @@ public class ReviewCommand extends SshCommand {
@Option(name = "--json", aliases = "-j", usage = "read review input json from stdin")
private boolean json;
@Option(name = "--strict-labels", usage = "Strictly check if the labels "
+ "specified can be applied to the given patch set(s)")
private boolean strictLabels;
@Option(name = "--label", aliases = "-l", usage = "custom label(s) to assign", metaVar = "LABEL=VALUE")
void addLabel(final String token) {
LabelVote v = LabelVote.parseWithEquals(token);
@ -272,7 +276,7 @@ public class ReviewCommand extends SshCommand {
review.notify = notify;
review.labels = Maps.newTreeMap();
review.drafts = ReviewInput.DraftHandling.PUBLISH;
review.strictLabels = false;
review.strictLabels = strictLabels;
for (ApproveOption ao : optionList) {
Short v = ao.value();
if (v != null) {