void (@NotNull List<? extends FilePath> filePaths) { for (Map.Entry<VirtualFile, Collection<FilePath>> entry : HgUtil.groupFilePathsByHgRoots(project, filePaths).entrySet()) { final VirtualFile repo = entry.getKey(); final Collection<FilePath> files = entry.getValue(); HgRevisionNumber revisionNumber = new HgWorkingCopyRevisionsCommand(project).firstParent(repo); for (List<String> chunk : VcsFileUtil.chunkPaths(repo, files)) { HgCommandResult revertResult = new HgRevertCommand(project).execute(repo, chunk, revisionNumber, false); if (HgErrorUtil.hasUncommittedChangesConflict(revertResult)) { String message = XmlStringUtil.wrapInHtml(HgBundle.message("hg4idea.revert.failed.msg", repo.getPresentableName())); int exitCode = HgUpdateCommand.showDiscardChangesConfirmation(project, message); if (exitCode == Messages.OK) { //discard all changes for this repository// HgUpdateCommand updateCommand = new HgUpdateCommand(project, repo); updateCommand.setClean(true); updateCommand.setRevision("."); updateCommand.execute(); } break; } new HgResolveCommand(project).markResolved(repo, files); } } }