Example #1
0
 @Nullable
 public static <T extends Repository> T guessRepositoryForFile(
     @NotNull Project project,
     @NotNull RepositoryManager<T> manager,
     @Nullable AbstractVcs vcs,
     @Nullable VirtualFile file,
     @Nullable String defaultRootPathValue) {
   T repository = manager.getRepositoryForRoot(guessVcsRoot(project, file));
   return repository != null
       ? repository
       : manager.getRepositoryForRoot(guessRootForVcs(project, vcs, defaultRootPathValue));
 }
 @NotNull
 protected Collection<VirtualFile> getAffectedRoots() {
   return myRepoManager
       .getRepositories()
       .stream()
       .filter(repo -> !repo.isFresh())
       .map(Repository::getRoot)
       .filter(root -> myCheckinPanel.getRoots().contains(root))
       .collect(Collectors.toList());
 }
Example #3
0
 @NotNull
 public static <R extends Repository> Map<R, List<VcsFullCommitDetails>> groupCommitsByRoots(
     @NotNull RepositoryManager<R> repoManager,
     @NotNull List<? extends VcsFullCommitDetails> commits) {
   Map<R, List<VcsFullCommitDetails>> groupedCommits = ContainerUtil.newHashMap();
   for (VcsFullCommitDetails commit : commits) {
     R repository = repoManager.getRepositoryForRoot(commit.getRoot());
     if (repository == null) {
       LOGGER.info("No repository found for commit " + commit);
       continue;
     }
     List<VcsFullCommitDetails> commitsInRoot = groupedCommits.get(repository);
     if (commitsInRoot == null) {
       commitsInRoot = ContainerUtil.newArrayList();
       groupedCommits.put(repository, commitsInRoot);
     }
     commitsInRoot.add(commit);
   }
   return groupedCommits;
 }