Provide a way to lock patch sets

Add a new function type that provides a way to prevent new patch sets
from being added to a change. Defining a label with this function and
applying a +1 vote with that label onto a change will stop: 1) new
patch upload, 2) rebase, and 3) abandon.

Like NoBlock/NoOp, its value will never affect submittability.

Change-Id: Ib0d81d85e797f522d80da8c474a711ec5021f4b6
This commit is contained in:
Nasser Grainawi
2015-11-09 09:56:56 -08:00
parent c767f0a26a
commit 240ea29e21
10 changed files with 128 additions and 22 deletions

View File

@@ -1966,7 +1966,7 @@ public class ReceiveCommits {
}
}
boolean validate(boolean autoClose) throws IOException {
boolean validate(boolean autoClose) throws IOException, OrmException {
if (!autoClose && inputCommand.getResult() != NOT_ATTEMPTED) {
return false;
} else if (change == null) {
@@ -1989,8 +1989,12 @@ public class ReceiveCommits {
}
changeCtl = projectControl.controlFor(change);
if (!changeCtl.canAddPatchSet()) {
reject(inputCommand, "cannot replace " + ontoChange);
if (!changeCtl.canAddPatchSet(db)) {
String locked = ".";
if (changeCtl.isPatchSetLocked(db)) {
locked = ". Change is patch set locked.";
}
reject(inputCommand, "cannot replace " + ontoChange + locked);
return false;
} else if (change.getStatus().isClosed()) {
reject(inputCommand, "change " + ontoChange + " closed");