@Nullable
  private VcsAbstractHistorySession getSessionFromCacheWithLastRevisionCheck(@NotNull FilePath filePath,
                                                                             @NotNull VcsKey vcsKey,
                                                                             @NotNull VcsCacheableHistorySessionFactory<Serializable, VcsAbstractHistorySession> cacheableFactory) {
    ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
    if (indicator != null) {
      indicator.setText2(VcsBundle.message("file.history.checking.last.revision.process"));
    }
    VcsAbstractHistorySession cached = myVcsHistoryCache.getSession(filePath, vcsKey, cacheableFactory, false);
    if (cached == null || cached.getRevisionList().isEmpty()) return null;

    FilePath correctedFilePath = cacheableFactory.getUsedFilePath(cached);
    FilePath path = correctedFilePath != null ? correctedFilePath : filePath;

    VcsRevisionNumber currentRevision = null;
    if (VcsType.distributed.equals(myType)) {
      currentRevision = cached.calcCurrentRevisionNumberForCache();
    }
    else {
      ItemLatestState lastRevision = myDiffProvider.getLastRevision(path);
      if (lastRevision != null && !lastRevision.isDefaultHead() && lastRevision.isItemExists()) {
        currentRevision = lastRevision.getNumber();
      }
    }

    if (cached.getRevisionList().get(0).getRevisionNumber().equals(currentRevision)) {
      return cached;
    }
    return null;
  }
@Nullable
  private VcsAbstractHistorySession getSessionFromCacheWithLastRevisionCheck(@NotNull FilePath filePath,
                                                                             @NotNull VcsKey vcsKey,
                                                                             @NotNull VcsCacheableHistorySessionFactory<Serializable, VcsAbstractHistorySession> cacheableFactory)