Create new patch set references before database records

Ensure the commit used by a new change or replacement patch set
always exists in the Git repository by writing the reference first
as part of the overall BatchRefUpdate, then inserting the database
records if all of the references stored successfully.

This refactoring simplifies some of the logic involved, and lets
some JGit backends that benefit from batching references see all
updates at once, which may reduce the overall transaction time.

Change-Id: Id5a4d8c3d7abd035accc9682714ac782924f0a33
This commit is contained in:
Shawn O. Pearce
2012-07-26 12:36:55 -07:00
parent 1732f75709
commit e6298f7216
2 changed files with 561 additions and 431 deletions

View File

@@ -491,6 +491,10 @@ public final class Change {
--nbrPatchSets;
}
public void updateNumberOfPatchSets(int max) {
nbrPatchSets = Math.max(nbrPatchSets, max);
}
public PatchSet.Id currPatchSetId() {
return new PatchSet.Id(changeId, nbrPatchSets);
}