Publish draft patchsets in UI and SSH

Adds Publish button to draft patchsets in UI and an option to
publish draft patchsets in the review ssh command. Publishing a draft
patchset makes it visible. Publishing a draft patchset in a draft
change irreversibly upgrades the change status to NEW.

Change-Id: I8ad8ed9d69f3f9e876a9288f568ae3e003a0e257
This commit is contained in:
Jason Tsay
2011-07-22 18:42:36 -07:00
committed by Mohan Zhang
parent 172a1fd899
commit 61cdb499e6
10 changed files with 177 additions and 2 deletions

View File

@@ -104,6 +104,9 @@ public class ReviewCommand extends BaseCommand {
+ "even if the label score cannot be applied due to change being closed")
private boolean forceMessage = false;
@Option(name = "--publish", usage = "publish a draft patch set")
private boolean publishPatchSet;
@Inject
private ReviewDb db;
@@ -155,6 +158,17 @@ public class ReviewCommand extends BaseCommand {
if (submitChange) {
throw error("abandon and submit actions are mutually exclusive");
}
if (publishPatchSet) {
throw error("abandon and publish actions are mutually exclusive");
}
}
if (publishPatchSet) {
if (restoreChange) {
throw error("publish and restore actions are mutually exclusive");
}
if (submitChange) {
throw error("publish and submit actions are mutually exclusive");
}
}
boolean ok = true;
@@ -315,6 +329,13 @@ public class ReviewCommand extends BaseCommand {
throw new Failure(1, "Unsupported status " + result.get(0).status);
}
}
if (publishPatchSet) {
if (changeControl.isOwner() && changeControl.isVisible(db)) {
ChangeUtil.publishDraftPatchSet(db, patchSetId);
} else {
throw error("Not permitted to publish draft patchset");
}
}
}
private Set<PatchSet.Id> parsePatchSetId(final String patchIdentity)