Rebase: Use correct ChangeNotes when looking up patch set

Change-Id: I9a2ee954f536777ddce171de0e525df8f3394198
This commit is contained in:
Dave Borowitz
2016-01-22 12:45:30 -05:00
parent d5db7d0ed0
commit 79419f4b39

View File

@@ -195,9 +195,13 @@ public class Rebase implements RestModifyView<RevisionResource, RebaseInput>,
// Try parsing the base as a ref string.
PatchSet.Id basePatchSetId = PatchSet.Id.fromRef(base);
if (basePatchSetId != null) {
return Base.create(
controlFor(rsrc, basePatchSetId.getParentKey()),
psUtil.get(db, rsrc.getNotes(), basePatchSetId));
Change.Id baseChangeId = basePatchSetId.getParentKey();
ChangeControl baseCtl = controlFor(rsrc, baseChangeId);
if (baseCtl != null) {
return Base.create(
controlFor(rsrc, basePatchSetId.getParentKey()),
psUtil.get(db, baseCtl.getNotes(), basePatchSetId));
}
}
// Try parsing base as a change number (assume current patch set).
@@ -229,6 +233,9 @@ public class Rebase implements RestModifyView<RevisionResource, RebaseInput>,
private ChangeControl controlFor(RevisionResource rsrc, Change.Id id)
throws OrmException {
if (rsrc.getChange().getId().equals(id)) {
return rsrc.getControl();
}
Change c = dbProvider.get().changes().get(id);
if (c == null) {
return null;