ReceiveCommits: Set push certificate on patch sets
Bug: Issue 4262 Change-Id: Ifb1145c7ae637a9e8d6b33c0019fdc0bc2d3d845
This commit is contained in:
@@ -124,6 +124,7 @@ public class ChangeInserter extends BatchUpdate.InsertChangeOp {
|
|||||||
private ChangeMessage changeMessage;
|
private ChangeMessage changeMessage;
|
||||||
private PatchSetInfo patchSetInfo;
|
private PatchSetInfo patchSetInfo;
|
||||||
private PatchSet patchSet;
|
private PatchSet patchSet;
|
||||||
|
private String pushCert;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
ChangeInserter(ProjectControl.GenericFactory projectControlFactory,
|
ChangeInserter(ProjectControl.GenericFactory projectControlFactory,
|
||||||
@@ -275,6 +276,10 @@ public class ChangeInserter extends BatchUpdate.InsertChangeOp {
|
|||||||
updateRefCommand = cmd;
|
updateRefCommand = cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setPushCertificate(String cert) {
|
||||||
|
pushCert = cert;
|
||||||
|
}
|
||||||
|
|
||||||
public PatchSet getPatchSet() {
|
public PatchSet getPatchSet() {
|
||||||
checkState(patchSet != null,
|
checkState(patchSet != null,
|
||||||
"getPatchSet() only valid after creating change");
|
"getPatchSet() only valid after creating change");
|
||||||
@@ -335,7 +340,7 @@ public class ChangeInserter extends BatchUpdate.InsertChangeOp {
|
|||||||
newGroups = GroupCollector.getDefaultGroups(commit);
|
newGroups = GroupCollector.getDefaultGroups(commit);
|
||||||
}
|
}
|
||||||
patchSet = psUtil.insert(ctx.getDb(), ctx.getRevWalk(), update, psId,
|
patchSet = psUtil.insert(ctx.getDb(), ctx.getRevWalk(), update, psId,
|
||||||
commit, draft, newGroups, null);
|
commit, draft, newGroups, pushCert);
|
||||||
|
|
||||||
/* TODO: fixStatus is used here because the tests
|
/* TODO: fixStatus is used here because the tests
|
||||||
* (byStatusClosed() in AbstractQueryChangesTest)
|
* (byStatusClosed() in AbstractQueryChangesTest)
|
||||||
|
|||||||
@@ -1785,6 +1785,9 @@ public class ReceiveCommits {
|
|||||||
cmd = new ReceiveCommand(ObjectId.zeroId(), commit,
|
cmd = new ReceiveCommand(ObjectId.zeroId(), commit,
|
||||||
ins.getPatchSetId().toRefName());
|
ins.getPatchSetId().toRefName());
|
||||||
ins.setUpdateRefCommand(cmd);
|
ins.setUpdateRefCommand(cmd);
|
||||||
|
if (rp.getPushCertificate() != null) {
|
||||||
|
ins.setPushCertificate(rp.getPushCertificate().toTextWithSignature());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addOps(BatchUpdate bu) throws RestApiException {
|
private void addOps(BatchUpdate bu) throws RestApiException {
|
||||||
|
|||||||
Reference in New Issue
Block a user