Prefer to pass ChangeNotes to ProjectControl.controlFor

Where available pass ChangesNotes to ProjectControl.controlFor instead
of Change, because the ChangesNotes are needed anyway and this way we
might not need to recreate them.

Change-Id: I1fc9c8701d13b7e5dccdbb09da91af3affbf9499
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2016-01-29 16:59:00 +01:00
parent 4ab48ed5f1
commit dfb1bdfdca
3 changed files with 3 additions and 3 deletions

View File

@@ -186,7 +186,7 @@ public class CherryPickChange {
// The change key exists on the destination branch. The cherry pick
// will be added as a new patch set.
ChangeControl destCtl = refControl.getProjectControl()
.controlFor(destChanges.get(0).change());
.controlFor(destChanges.get(0).notes());
return insertPatchSet(git, revWalk, oi, destCtl,
cherryPickCommit, refControl, identifiedUser);
} else {

View File

@@ -223,7 +223,7 @@ public class Rebase implements RestModifyView<RevisionResource, RebaseInput>,
}
if (ret == null || ret.patchSet().getId().get() < ps.getId().get()) {
ret = Base.create(
rsrc.getControl().getProjectControl().controlFor(cd.change()),
rsrc.getControl().getProjectControl().controlFor(cd.notes()),
ps);
}
}

View File

@@ -222,7 +222,7 @@ class RelatedChangesSorter {
throws OrmException {
// Reuse existing project control rather than lazily creating a new one for
// each ChangeData.
return ctl.controlFor(psd.data().change())
return ctl.controlFor(psd.data().notes())
.isPatchVisible(psd.patchSet(), psd.data());
}