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:
@@ -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
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user