Replace calls of ChangeNotes#getChange()

In future a change from ChangeNotes is only available after the notes
have been loaded, but project and change ID are known before. Avoid
calling getChange() when only project and change ID are required so
that loading the notes is not required in this case.

Change-Id: I172d94e9550c28797f0a7a6b20c4b4bc64e9dbfc
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2016-01-29 14:59:33 +01:00
parent 416dd77400
commit 0c133c550d
7 changed files with 13 additions and 12 deletions

View File

@@ -213,7 +213,7 @@ public class ChangeUtil {
}
Change changeToRevert = db.get().changes().get(changeIdToRevert);
Project.NameKey project = ctl.getChange().getProject();
Project.NameKey project = ctl.getProject().getNameKey();
try (Repository git = gitManager.openRepository(project);
RevWalk revWalk = new RevWalk(git)) {
RevCommit commitToRevert =
@@ -309,7 +309,7 @@ public class ChangeUtil {
}
try (Repository git =
gitManager.openRepository(notes.getChange().getProject());
gitManager.openRepository(notes.getProjectName());
RevWalk revWalk = new RevWalk(git)) {
RevCommit commit = revWalk.parseCommit(
ObjectId.fromString(ps.getRevision().get()));