Search in sources :

Example 1 with RefCache

use of com.google.gerrit.server.git.RefCache in project gerrit by GerritCodeReview.

the class ChangeNotes method openHandle.

@Override
protected LoadHandle openHandle(Repository repo) throws NoSuchChangeException, IOException {
    if (autoRebuild) {
        NoteDbChangeState state = NoteDbChangeState.parse(change);
        ObjectId id = readRef(repo);
        if (id == null) {
            if (state == null) {
                return super.openHandle(repo, id);
            } else if (shouldExist) {
                throw new NoSuchChangeException(getChangeId());
            }
        }
        RefCache refs = this.refs != null ? this.refs : new RepoRefCache(repo);
        if (!NoteDbChangeState.isChangeUpToDate(state, refs, getChangeId())) {
            return rebuildAndOpen(repo, id);
        }
    }
    return super.openHandle(repo);
}
Also used : RepoRefCache(com.google.gerrit.server.git.RepoRefCache) NoSuchChangeException(com.google.gerrit.server.project.NoSuchChangeException) ObjectId(org.eclipse.jgit.lib.ObjectId) RepoRefCache(com.google.gerrit.server.git.RepoRefCache) RefCache(com.google.gerrit.server.git.RefCache)

Aggregations

RefCache (com.google.gerrit.server.git.RefCache)1 RepoRefCache (com.google.gerrit.server.git.RepoRefCache)1 NoSuchChangeException (com.google.gerrit.server.project.NoSuchChangeException)1 ObjectId (org.eclipse.jgit.lib.ObjectId)1