Refactor ReplaceOp for updating change rest api

Similar to ChangeInserter which is used by both ReceiveCommits and
CreateChange, make RequestScopePropagator optional and add update
ref option.

Change-Id: I436bc97a2da223cda79374a6815fa97c71753b51
This commit is contained in:
Zhen Chen
2016-09-23 12:57:38 -07:00
parent 8f5d1b1f4e
commit 886c95b98c
2 changed files with 35 additions and 10 deletions

View File

@@ -2400,10 +2400,12 @@ public class ReceiveCommits {
rw.parseBody(newCommit);
RevCommit priorCommit = revisions.inverse().get(priorPatchSet);
replaceOp = replaceOpFactory.create(requestScopePropagator,
projectControl, notes.getChange().getDest(), checkMergedInto,
priorPatchSet, priorCommit, psId, newCommit, info, groups,
magicBranch, rp.getPushCertificate());
replaceOp = replaceOpFactory
.create(projectControl, notes.getChange().getDest(), checkMergedInto,
priorPatchSet, priorCommit, psId, newCommit, info, groups,
magicBranch, rp.getPushCertificate())
.setRequestScopePropagator(requestScopePropagator)
.setUpdateRef(false);
bu.addOp(notes.getChangeId(), replaceOp);
if (progress != null) {
bu.addOp(notes.getChangeId(), new ChangeProgressOp(progress));