void (@NotNull Collection<? extends VirtualFile> files, @Nullable ProgressIndicator indicator) { final Map<VirtualFile, Collection<VirtualFile>> sorted = HgUtil.sortByHgRoots(myProject, files); for (Map.Entry<VirtualFile, Collection<VirtualFile>> entry : sorted.entrySet()) { if (indicator != null) { if (indicator.isCanceled()) return; indicator.setFraction(0); indicator.setText2(HgBundle.message("hg4idea.add.files.progress", entry.getKey().getPresentableUrl())); } addFilesSynchronously(entry.getKey(), entry.getValue(), indicator); } }