Search in sources :

Example 6 with VcsAbstractHistorySession

use of com.intellij.openapi.vcs.history.VcsAbstractHistorySession in project intellij-community by JetBrains.

the class GitAnnotationProvider method loadFileHistory.

@Nullable
private List<VcsFileRevision> loadFileHistory(@NotNull FilePath filePath) throws VcsException {
    GitVcs vcs = GitVcs.getInstance(myProject);
    if (vcs == null)
        return null;
    GitHistoryProvider historyProvider = vcs.getVcsHistoryProvider();
    VcsAbstractHistorySession cachedSession = myCache.getFull(filePath, vcs.getKeyInstanceMethod(), historyProvider);
    if (cachedSession != null && !ContainerUtil.isEmpty(cachedSession.getRevisionList())) {
        return cachedSession.getRevisionList();
    } else {
        VcsAbstractHistorySession session = historyProvider.createSessionFor(filePath);
        if (session == null)
            return null;
        myCache.put(filePath, null, vcs.getKeyInstanceMethod(), session, historyProvider, true);
        return session.getRevisionList();
    }
}
Also used : GitVcs(git4idea.GitVcs) GitHistoryProvider(git4idea.history.GitHistoryProvider) VcsAbstractHistorySession(com.intellij.openapi.vcs.history.VcsAbstractHistorySession) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

VcsAbstractHistorySession (com.intellij.openapi.vcs.history.VcsAbstractHistorySession)6 VcsAppendableHistorySessionPartner (com.intellij.openapi.vcs.history.VcsAppendableHistorySessionPartner)5 VcsFileRevision (com.intellij.openapi.vcs.history.VcsFileRevision)5 VcsHistoryProvider (com.intellij.openapi.vcs.history.VcsHistoryProvider)5 Semaphore (com.intellij.util.concurrency.Semaphore)5 Test (org.junit.Test)5 GitVcs (git4idea.GitVcs)1 GitHistoryProvider (git4idea.history.GitHistoryProvider)1 Nullable (org.jetbrains.annotations.Nullable)1