use of org.zmlx.hg4idea.repo.HgRepository in project intellij-community by JetBrains.
the class HgUtil method groupFilePathsByHgRoots.
@NotNull
public static Map<VirtualFile, Collection<FilePath>> groupFilePathsByHgRoots(@NotNull Project project, @NotNull Collection<FilePath> files) {
Map<VirtualFile, Collection<FilePath>> sorted = new HashMap<>();
if (project.isDisposed())
return sorted;
HgRepositoryManager repositoryManager = getRepositoryManager(project);
for (FilePath file : files) {
HgRepository repo = repositoryManager.getRepositoryForFile(file);
if (repo == null) {
continue;
}
Collection<FilePath> filesForRoot = sorted.get(repo.getRoot());
if (filesForRoot == null) {
filesForRoot = new HashSet<>();
sorted.put(repo.getRoot(), filesForRoot);
}
filesForRoot.add(file);
}
return sorted;
}
Aggregations