void (@NotNull final HgRepository repository, @NotNull final Hash commit) { final Project project = repository.getProject(); FileDocumentManager.getInstance().saveAllDocuments(); String shortHash = commit.toShortString(); final String name = getNewBranchNameFromUser(repository, HgBundle.message("hg4idea.branch.create.from", shortHash)); if (name != null) { new Task.Backgroundable(project, HgBundle.message("hg4idea.progress.updatingTo", shortHash)) { @Override public void run(@NotNull ProgressIndicator indicator) { if (HgUpdateCommand.updateRepoToInCurrentThread(project, repository.getRoot(), commit.asString(), false)) { new HgBranchPopupActions.HgNewBranchAction(project, Collections.singletonList(repository), repository) .createNewBranchInCurrentThread(name); } } }.queue(); } }