Use repo from BatchUpdate.Context directly more often
Avoid some ugly indirection where we do nothing in the updateRepo phase but read something from the repo for use in updateChange. Change-Id: Ibc646fc9b0e0dfb5e9f956b1919f7d7670ba0d74
This commit is contained in:
@@ -84,7 +84,6 @@ public class ChangeInserter extends BatchUpdate.InsertChangeOp {
|
||||
|
||||
private final RefControl refControl;
|
||||
private final IdentifiedUser user;
|
||||
private final Change change;
|
||||
private final PatchSet patchSet;
|
||||
private final RevCommit commit;
|
||||
|
||||
@@ -101,6 +100,7 @@ public class ChangeInserter extends BatchUpdate.InsertChangeOp {
|
||||
private boolean updateRef;
|
||||
|
||||
// Fields set during the insertion process.
|
||||
private Change change;
|
||||
private ChangeMessage changeMessage;
|
||||
private PatchSetInfo patchSetInfo;
|
||||
|
||||
@@ -230,9 +230,6 @@ public class ChangeInserter extends BatchUpdate.InsertChangeOp {
|
||||
public void updateRepo(RepoContext ctx)
|
||||
throws ResourceConflictException, IOException {
|
||||
validate(ctx);
|
||||
patchSetInfo = patchSetInfoFactory.get(
|
||||
ctx.getRevWalk(), commit, patchSet.getId());
|
||||
change.setCurrentPatchSet(patchSetInfo);
|
||||
if (!updateRef) {
|
||||
return;
|
||||
}
|
||||
@@ -242,9 +239,14 @@ public class ChangeInserter extends BatchUpdate.InsertChangeOp {
|
||||
|
||||
@Override
|
||||
public void updateChange(ChangeContext ctx) throws OrmException, IOException {
|
||||
change = ctx.getChange(); // Use defensive copy created by ChangeControl.
|
||||
ReviewDb db = ctx.getDb();
|
||||
ChangeControl ctl = ctx.getChangeControl();
|
||||
ChangeUpdate update = ctx.getChangeUpdate();
|
||||
patchSetInfo = patchSetInfoFactory.get(
|
||||
ctx.getRevWalk(), commit, patchSet.getId());
|
||||
ctx.getChange().setCurrentPatchSet(patchSetInfo);
|
||||
|
||||
if (patchSet.getGroups() == null) {
|
||||
patchSet.setGroups(GroupCollector.getDefaultGroups(patchSet));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user