Add option to make approved patches be auto-submitted

Add a "Publish & Submit" button to the web review screen.  This
button performs the actions that the "Publish Comments" button
performs while additionally submitting the patch for merging.

Bug: issue 391
Change-Id: If9f3415be1378e9303afe34486dce557a926dc71
This commit is contained in:
Martin Fick
2010-06-10 15:23:26 -06:00
committed by Shawn O. Pearce
parent cc468b1cf7
commit 6858e2d84f
6 changed files with 60 additions and 10 deletions

View File

@@ -185,11 +185,7 @@ public class ChangeControl {
}
/** @return {@link CanSubmitResult#OK}, or a result with an error message. */
public CanSubmitResult canSubmit(final PatchSet.Id patchSetId, final ReviewDb db,
final ApprovalTypes approvalTypes,
FunctionState.Factory functionStateFactory)
throws OrmException {
public CanSubmitResult canSubmit(final PatchSet.Id patchSetId) {
if (change.getStatus().isClosed()) {
return new CanSubmitResult("Change " + change.getId() + " is closed");
}
@@ -202,6 +198,19 @@ public class ChangeControl {
if (!(getCurrentUser() instanceof IdentifiedUser)) {
return new CanSubmitResult("User is not signed-in");
}
return CanSubmitResult.OK;
}
/** @return {@link CanSubmitResult#OK}, or a result with an error message. */
public CanSubmitResult canSubmit(final PatchSet.Id patchSetId, final ReviewDb db,
final ApprovalTypes approvalTypes,
FunctionState.Factory functionStateFactory)
throws OrmException {
CanSubmitResult result = canSubmit(patchSetId);
if (result != CanSubmitResult.OK) {
return result;
}
final List<PatchSetApproval> allApprovals =
new ArrayList<PatchSetApproval>(db.patchSetApprovals().byPatchSet(