Return more structured result from ChangeRebuilder

Refactors ChangeRebuilder and NoteDbUpdateManager to return a new type
encapsulating both the new NoteDbChangeState (which is intentionally
not part of the original staged result) and the underlying staged
result with its possibly-not-yet-written NoteDb data.

Change-Id: I2ff014e9fe01910a2b77b1f5417f1f11dc84b610
This commit is contained in:
Dave Borowitz
2016-06-16 11:38:46 -04:00
parent 5d4830d449
commit 1635b5d6a4
10 changed files with 51 additions and 40 deletions

View File

@@ -160,12 +160,12 @@ public class DraftCommentNotes extends AbstractChangeNotes<DraftCommentNotes> {
private LoadHandle rebuildAndOpen(Repository repo) throws IOException {
try {
NoteDbChangeState newState =
NoteDbUpdateManager.Result r =
args.rebuilder.get().rebuild(args.db.get(), getChangeId());
if (newState == null) {
if (r == null) {
return super.openHandle(repo); // May be null in tests.
}
ObjectId draftsId = newState.getDraftIds().get(author);
ObjectId draftsId = r.newState().getDraftIds().get(author);
repo.scanForRepoChanges();
return LoadHandle.create(ChangeNotesCommit.newRevWalk(repo), draftsId);
} catch (NoSuchChangeException e) {