void (final @NotNull HgRepository repository, final @NotNull VcsFullCommitDetails commit) { final Project project = repository.getProject(); List<Hash> parents = commit.getParents(); final Hash parentHash = parents.isEmpty() ? null : parents.get(0); final HgNameWithHashInfo parentPatchName = ContainerUtil.find(repository.getMQAppliedPatches(), info -> info.getHash().equals(parentHash)); new Task.Backgroundable(repository.getProject(), parentPatchName != null ? HgBundle.message("hg4idea.mq.progress.goto", parentPatchName) : HgBundle.message("hg4idea.mq.progress.pop")) { @Override public void run(@NotNull ProgressIndicator indicator) { if (parentPatchName != null) { new HgQGotoCommand(repository).executeInCurrentThread(parentPatchName.getName()); } else { new HgQPopCommand(repository).executeInCurrentThread(); } } @Override public void onSuccess() { HgShowUnAppliedPatchesAction.showUnAppliedPatches(project, repository); } }.queue(); }