Update code refs and NoteDb meta refs in one batch

Within NoteDbBatchUpdate, always use the revwalk, inserter, and
commands from the single RepoView associated with the update. All
BatchUpdateOp#updateChange implementations have been converted to
inspect the limited kinds of repo state exposed by RepoView, so they
will see the results of updateRepo even though the ref updates have not
been executed yet.

One complication comes from the fact that NoteDbUpdateManager really
wants to control execution of the BatchRefUpdates via its own execute
method. We have to make sure the execute method is deferred until after
updateRepo has been called. This requires expanding the previous
ChangeResults returned by executeChangeUps into something a little more
beefy.

Change-Id: Ia5b34bae93630f6d4dbeddb4ad5ce725ba5c6147
This commit is contained in:
Dave Borowitz
2017-03-24 09:35:32 -07:00
parent 3915d7baa1
commit 18349b9a19
10 changed files with 372 additions and 163 deletions

View File

@@ -105,6 +105,17 @@ public class RefNames {
return r.toString();
}
public static boolean isNoteDbMetaRef(String ref) {
if (ref.startsWith(REFS_CHANGES)
&& (ref.endsWith(META_SUFFIX) || ref.endsWith(ROBOT_COMMENTS_SUFFIX))) {
return true;
}
if (ref.startsWith(REFS_DRAFT_COMMENTS) || ref.startsWith(REFS_STARRED_CHANGES)) {
return true;
}
return false;
}
public static String refsUsers(Account.Id accountId) {
StringBuilder r = new StringBuilder();
r.append(REFS_USERS);