@NotNull
  @RequiresBackgroundThread
  public static <R extends Repository> Map<R, List<VcsCommitMetadata>> groupCommitsByRoots(@NotNull RepositoryManager<R> repoManager,
                                                                                              @NotNull List<? extends VcsCommitMetadata> commits) {
    Map<R, List<VcsCommitMetadata>> groupedCommits = new HashMap<>();
    for (VcsCommitMetadata commit : commits) {
      R repository = repoManager.getRepositoryForRoot(commit.getRoot());
      if (repository == null) {
        LOG.info("No repository found for commit " + commit);
        continue;
      }
      List<VcsCommitMetadata> commitsInRoot = groupedCommits.computeIfAbsent(repository, __ -> new ArrayList<>());
      commitsInRoot.add(commit);
    }
    return groupedCommits;
  }
@NotNull
  @RequiresBackgroundThread
  public static <R extends Repository> Map<R, List<VcsCommitMetadata>> groupCommitsByRoots(@NotNull RepositoryManager<R> repoManager,
                                                                                              @NotNull List<? extends VcsCommitMetadata> commits)