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:
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user