private void indexOneByOne(@NotNull IntStream commits, @NotNull ProgressIndicator indicator, @NotNull VcsLogWriter mutator)
      throws VcsException {
      // We pass hashes to VcsLogProvider#readFullDetails in batches
      // in order to avoid allocating too much memory for these hashes
      // a batch of 20k will occupy ~2.4Mb
      IntCollectionUtil.processBatches(commits, BATCH_SIZE, batch -> {
        indicator.checkCanceled();

        Map<@NotNull Integer, @NotNull CommitId> ids = myStorage.getCommitIds(batch);
        List<String> hashes = ContainerUtil.map(ids.values(), value -> value.getHash().asString());
        myIndexers.get(myRoot).readFullDetails(myRoot, hashes, myPathsEncoder, detail -> {
          indicator.checkCanceled();
          storeDetail(detail, mutator);
          if (myNewIndexedCommits.incrementAndGet() % myFlushedCommitsNumber == 0) {
            mutator.flush();
          }

          checkShouldCancel(indicator);
        });

        if (LOG.isDebugEnabled()) {
          int unindexedCommits = myCommits.size() - myNewIndexedCommits.get() - myOldCommits.get();
          LOG.debug("Processed index batch, " + unindexedCommits + " unindexed commits left");
        }
      });
    }
private void indexOneByOne(@NotNull IntStream commits, @NotNull ProgressIndicator indicator, @NotNull VcsLogWriter mutator)