@Nullable
  private byte[] loadFromVersionControl(long date, VirtualFile f) {
    try {
      final AbstractVcs vcs = VcsUtil.getVcsFor(myProject, f);
      if (vcs == null) return null;

      final VcsHistoryProvider historyProvider = vcs.getVcsHistoryProvider();
      if (historyProvider == null) return null;

      final FilePath filePath = VcsContextFactory.SERVICE.getInstance().createFilePathOn(f);
      final VcsHistorySession session = historyProvider.createSessionFor(filePath);
      if (session == null) return null;

      final List<VcsFileRevision> list = session.getRevisionList();

      if (list != null) {
        for (VcsFileRevision revision : list) {
          final Date revisionDate = revision.getRevisionDate();
          if (revisionDate == null) {
            return null;
          }

          if (revisionDate.getTime() < date) {
            return revision.loadContent();
          }
        }
      }
    } catch (Exception e) {
      LOG.info(e);
      return null;
    }
    return null;
  }
  @Override
  protected void actionPerformed(@NotNull VcsContext context) {
    Project project = context.getProject();
    Pair<FilePath, VirtualFile> pair = getPathAndParentFile(context);
    FilePath path = assertNotNull(pair.first);
    VirtualFile fileOrParent = assertNotNull(pair.second);
    AbstractVcs vcs = assertNotNull(ChangesUtil.getVcsForFile(fileOrParent, project));
    VcsHistoryProvider provider = assertNotNull(vcs.getVcsHistoryProvider());

    AbstractVcsHelper.getInstance(project)
        .showFileHistory(provider, vcs.getAnnotationProvider(), path, null, vcs);
  }
  private static boolean isEnabled(
      @NotNull Project project, @NotNull FilePath path, @NotNull VirtualFile fileOrParent) {
    boolean result = false;
    AbstractVcs vcs = ChangesUtil.getVcsForFile(fileOrParent, project);

    if (vcs != null) {
      VcsHistoryProvider provider = vcs.getVcsHistoryProvider();

      result =
          provider != null
              && (provider.supportsHistoryForDirectories() || !path.isDirectory())
              && AbstractVcs.fileInVcsByFileStatus(project, fileOrParent)
              && provider.canShowHistoryFor(fileOrParent);
    }

    return result;
  }