public static void readLog(@NotNull Project project, @NotNull VirtualFile root, @NotNull HgVersion version, int limit,
                             @NotNull List<String> hashes, @NotNull String template, @NotNull Consumer<? super StringBuilder> consumer)
    throws VcsException {
    HgLogCommand hgLogCommand = new HgLogCommand(project);
    hgLogCommand.setLogFile(false);

    ThrowableConsumer<List<String>, VcsException> logRunner = hashesChunk -> {
      HgLogOutputSplitter splitter = new HgLogOutputSplitter(consumer);
      List<String> args = new ArrayList<>(hashesChunk);
      if (!version.isParentRevisionTemplateSupported()) {
        args.add("--debug");
      }
      hgLogCommand.execute(root, template, limit, getOriginalHgFile(project, root), args, splitter);
      splitter.finish();
    };

    if (hashes.isEmpty()) {
      // no hashes provided means need to read the whole thing
      logRunner.consume(hashes);
    }
    else {
      VcsFileUtil.foreachChunk(hashes, 2, logRunner);
    }
  }
public static void readLog(@NotNull Project project, @NotNull VirtualFile root, @NotNull HgVersion version, int limit,
                             @NotNull List<String> hashes, @NotNull String template, @NotNull Consumer<? super StringBuilder> consumer)