}
public Id putCommit(PutToken token, MutableCommit commit) throws Exception {
verifyInitialized();
Id commitId = writeCommit(token, commit);
tokensLock.writeLock().lock();
try {
putTokens.remove(token);
} finally {
tokensLock.writeLock().unlock();
}
Id branchRootId = commit.getBranchRootId();
if (branchRootId != null) {
synchronized (branches) {
Id parentId = commit.getParentId();
if (!parentId.equals(branchRootId)) {
/* not the first branch commit, replace its head */
branches.remove(parentId);
}
branches.put(commitId, branchRootId);
}