Add --notify option to SSH review command

This allows to control to whom to send email notifications to after
the review is stored.

Change-Id: Ifbef1419e59a8cb5750cb0e48f47b6652aae9e36
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2013-11-24 07:42:29 +01:00
parent 662e55f6af
commit b926a7c0d8
2 changed files with 18 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ SYNOPSIS
'ssh' -p <port> <host> 'gerrit review' 'ssh' -p <port> <host> 'gerrit review'
[--project <PROJECT> | -p <PROJECT>] [--project <PROJECT> | -p <PROJECT>]
[--message <MESSAGE> | -m <MESSAGE>] [--message <MESSAGE> | -m <MESSAGE>]
[--notify <NOTIFYHANDLING> | -n <NOTIFYHANDLING>]
[--submit | -s] [--submit | -s]
[--abandon | --restore] [--abandon | --restore]
[--publish] [--publish]
@@ -51,6 +52,18 @@ OPTIONS
Optional cover letter to include as part of the message Optional cover letter to include as part of the message
sent to reviewers when the approval states are updated. sent to reviewers when the approval states are updated.
--notify::
-n::
Who to send email notifications to after the review is stored.
This option only applies for storing the review, but not for any
other action (abandon, restore etc.) done by this command.
+
* NONE: send no email
* OWNER: send email to change owners
* OWNER_REVIEWERS: send email to change owners and reviewers
* ALL: send email to all (change owners, reviewers, watchers and any
user who has starred the change)
--help:: --help::
-h:: -h::
Display site-specific usage information, including the Display site-specific usage information, including the

View File

@@ -26,6 +26,7 @@ import com.google.gerrit.extensions.api.GerritApi;
import com.google.gerrit.extensions.api.changes.AbandonInput; import com.google.gerrit.extensions.api.changes.AbandonInput;
import com.google.gerrit.extensions.api.changes.RestoreInput; import com.google.gerrit.extensions.api.changes.RestoreInput;
import com.google.gerrit.extensions.api.changes.ReviewInput; import com.google.gerrit.extensions.api.changes.ReviewInput;
import com.google.gerrit.extensions.api.changes.ReviewInput.NotifyHandling;
import com.google.gerrit.extensions.restapi.AuthException; import com.google.gerrit.extensions.restapi.AuthException;
import com.google.gerrit.extensions.restapi.BadRequestException; import com.google.gerrit.extensions.restapi.BadRequestException;
import com.google.gerrit.extensions.restapi.ResourceConflictException; import com.google.gerrit.extensions.restapi.ResourceConflictException;
@@ -93,6 +94,9 @@ public class ReviewCommand extends SshCommand {
@Option(name = "--message", aliases = "-m", usage = "cover message to publish on change(s)", metaVar = "MESSAGE") @Option(name = "--message", aliases = "-m", usage = "cover message to publish on change(s)", metaVar = "MESSAGE")
private String changeComment; private String changeComment;
@Option(name = "--notify", aliases = "-n", usage = "Who to send email notifications to after the review is stored.", metaVar = "NOTIFYHANDLING")
private NotifyHandling notify;
@Option(name = "--abandon", usage = "abandon the specified change(s)") @Option(name = "--abandon", usage = "abandon the specified change(s)")
private boolean abandonChange; private boolean abandonChange;
@@ -210,6 +214,7 @@ public class ReviewCommand extends SshCommand {
ReviewInput review = new ReviewInput(); ReviewInput review = new ReviewInput();
review.message = Strings.emptyToNull(changeComment); review.message = Strings.emptyToNull(changeComment);
review.notify = notify;
review.labels = Maps.newTreeMap(); review.labels = Maps.newTreeMap();
review.drafts = ReviewInput.DraftHandling.PUBLISH; review.drafts = ReviewInput.DraftHandling.PUBLISH;
review.strictLabels = false; review.strictLabels = false;