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 PatchSetInfo patchSetInfo;
|
||||
private PatchSet patchSet;
|
||||
private String pushCert;
|
||||
|
||||
@Inject
|
||||
ChangeInserter(ProjectControl.GenericFactory projectControlFactory,
|
||||
@@ -275,6 +276,10 @@ public class ChangeInserter extends BatchUpdate.InsertChangeOp {
|
||||
updateRefCommand = cmd;
|
||||
}
|
||||
|
||||
public void setPushCertificate(String cert) {
|
||||
pushCert = cert;
|
||||
}
|
||||
|
||||
public PatchSet getPatchSet() {
|
||||
checkState(patchSet != null,
|
||||
"getPatchSet() only valid after creating change");
|
||||
@@ -335,7 +340,7 @@ public class ChangeInserter extends BatchUpdate.InsertChangeOp {
|
||||
newGroups = GroupCollector.getDefaultGroups(commit);
|
||||
}
|
||||
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
|
||||
* (byStatusClosed() in AbstractQueryChangesTest)
|
||||
|
||||
@@ -1785,6 +1785,9 @@ public class ReceiveCommits {
|
||||
cmd = new ReceiveCommand(ObjectId.zeroId(), commit,
|
||||
ins.getPatchSetId().toRefName());
|
||||
ins.setUpdateRefCommand(cmd);
|
||||
if (rp.getPushCertificate() != null) {
|
||||
ins.setPushCertificate(rp.getPushCertificate().toTextWithSignature());
|
||||
}
|
||||
}
|
||||
|
||||
private void addOps(BatchUpdate bu) throws RestApiException {
|
||||
|
||||
Reference in New Issue
Block a user