@Nullable
  private <T> MultiMap<Repo, T> groupCommits(@NotNull Project project,
                                             @NotNull Collection<? extends T> commits,
                                             @NotNull Function<? super T, ? extends VirtualFile> rootGetter) {
    MultiMap<Repo, T> map = MultiMap.create();
    for (T commit : commits) {
      Repo root = getRepositoryForRoot(project, rootGetter.fun(commit));
      if (root == null) { // commit from some other VCS
        return null;
      }
      map.putValue(root, commit);
    }
    return map;
  }
@Nullable
  private <T> MultiMap<Repo, T> groupCommits(@NotNull Project project,
                                             @NotNull Collection<? extends T> commits,
                                             @NotNull Function<? super T, ? extends VirtualFile> rootGetter)