Merge "Add --rebase option to review command"

This commit is contained in:
Edwin Kempin 2014-09-10 10:07:20 +00:00 committed by Gerrit Code Review
commit 13eec766ab
2 changed files with 33 additions and 6 deletions
Documentation
gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands

@ -13,6 +13,7 @@ gerrit review - Apply reviews to one or more patch sets
[--notify <NOTIFYHANDLING> | -n <NOTIFYHANDLING>]
[--submit | -s]
[--abandon | --restore]
[--rebase]
[--publish]
[--json | -j]
[--delete]
@ -64,7 +65,7 @@ branch.
link:rest-api-changes.html#review-input[ReviewInput] entity for the
format.
(option is mutually exclusive with --submit, --restore, --publish, --delete,
--abandon and --message)
--abandon, --message and --rebase)
--notify::
-n::
@ -85,17 +86,22 @@ branch.
--abandon::
Abandon the specified change(s).
(option is mutually exclusive with --submit, --restore, --publish, --delete
and --json)
(option is mutually exclusive with --submit, --restore, --publish, --delete,
--rebase and --json)
--restore::
Restore the specified abandoned change(s).
(option is mutually exclusive with --abandon and --json)
--rebase::
Rebase the specified change(s).
(option is mutually exclusive with --abandon, --submit, --delete and --json)
--submit::
-s::
Submit the specified patch set(s) for merging.
(option is mutually exclusive with --abandon, --publish --delete and --json)
(option is mutually exclusive with --abandon, --publish --delete, --rebase
and --json)
--publish::
Publish the specified draft patch set(s).
@ -104,8 +110,8 @@ branch.
--delete::
Delete the specified draft patch set(s).
(option is mutually exclusive with --submit, --restore, --abandon, --publish
and --json)
(option is mutually exclusive with --submit, --restore, --abandon, --publish,
--rebase and --json)
--code-review::
--verified::

@ -105,6 +105,9 @@ public class ReviewCommand extends SshCommand {
@Option(name = "--restore", usage = "restore the specified abandoned change(s)")
private boolean restoreChange;
@Option(name = "--rebase", usage = "rebase the specified change(s)")
private boolean rebaseChange;
@Option(name = "--submit", aliases = "-s", usage = "submit the specified patch set(s)")
private boolean submitChange;
@ -154,6 +157,9 @@ public class ReviewCommand extends SshCommand {
if (deleteDraftPatchSet) {
throw error("abandon and delete actions are mutually exclusive");
}
if (rebaseChange) {
throw error("abandon and rebase actions are mutually exclusive");
}
}
if (publishPatchSet) {
if (restoreChange) {
@ -185,6 +191,17 @@ public class ReviewCommand extends SshCommand {
if (changeComment != null) {
throw error("json and message are mutually exclusive");
}
if (rebaseChange) {
throw error("json and rebase actions are mutually exclusive");
}
}
if (rebaseChange) {
if (deleteDraftPatchSet) {
throw error("rebase and delete actions are mutually exclusive");
}
if (submitChange) {
throw error("rebase and submit actions are mutually exclusive");
}
}
if (deleteDraftPatchSet && submitChange) {
throw error("delete and submit actions are mutually exclusive");
@ -285,6 +302,10 @@ public class ReviewCommand extends SshCommand {
applyReview(patchSet, review);
}
if (rebaseChange){
revisionApi(patchSet).rebase();
}
if (submitChange) {
revisionApi(patchSet).submit();
}