@NotNull
  public static <CommitInfo> List<CommitInfo> getCommitRecords(
      @NotNull Project project,
      @Nullable HgCommandResult result,
      @NotNull Function<String, CommitInfo> converter,
      boolean silent) {
    final List<CommitInfo> revisions = new LinkedList<CommitInfo>();
    if (result == null) {
      return revisions;
    }

    List<String> errors = result.getErrorLines();
    if (errors != null && !errors.isEmpty()) {
      if (result.getExitValue() != 0) {
        if (silent) {
          LOG.warn(errors.toString());
        } else {
          VcsNotifier.getInstance(project)
              .notifyError(
                  HgVcsMessages.message("hg4idea.error.log.command.execution"), errors.toString());
        }
        return Collections.emptyList();
      }
      LOG.warn(errors.toString());
    }
    String output = result.getRawOutput();
    List<String> changeSets = StringUtil.split(output, HgChangesetUtil.CHANGESET_SEPARATOR);
    return ContainerUtil.mapNotNull(changeSets, converter);
  }