@Nullable
  private static String findContentInFileHistory(@NotNull String versionId,
                                                 @NotNull VirtualFile file,
                                                 @NotNull FilePath pathBeforeRename,
                                                 @NotNull AbstractVcs vcs) throws VcsException {
    Date versionDate = parseVersionAsDate(versionId);
    String vcsRevisionString = parseVersionAsRevision(versionId, vcs);
    VcsRevisionNumber revision = vcsRevisionString != null ? vcs.parseRevisionNumber(vcsRevisionString, pathBeforeRename) : null;

    Condition<VcsFileRevision> condition;
    if (revision != null) {
      condition = fileRevision -> fileRevision.getRevisionNumber().compareTo(revision) <= 0;
    }
    else if (versionDate != null) {
      condition = fileRevision -> {
        Date date = fileRevision instanceof VcsFileRevisionEx fileRevisionEx ? fileRevisionEx.getAuthorDate()
                                                                             : fileRevision.getRevisionDate();
        return date != null && date.compareTo(versionDate) <= 0;
      };
    }
    else {
      return null;
    }

    ProgressManager.progress2(message("loading.text2.file.history.progress"));

    List<VcsFileRevision> list = getRevisions(pathBeforeRename, vcs);
    // TODO: try to download more than one version?
    VcsFileRevision foundRevision = ContainerUtil.find(list, condition);
    if (foundRevision == null) return null;

    try {
      byte[] byteContent = foundRevision.loadContent();
      if (byteContent == null) return null;

      return LoadTextUtil.getTextByBinaryPresentation(byteContent, file, false, false).toString();
    }
    catch (IOException e) {
      LOG.warn(e);
      return null;
    }
  }
@Nullable
  private static String findContentInFileHistory(@NotNull String versionId,
                                                 @NotNull VirtualFile file,
                                                 @NotNull FilePath pathBeforeRename,
                                                 @NotNull AbstractVcs vcs)