From e479b24e05ffbbf0ec2c300ba783ca4f80ee0b96 Mon Sep 17 00:00:00 2001 From: Nadya Zabrodina Date: Thu, 3 Mar 2016 18:23:27 +0300 Subject: [PATCH] [hg]: execute QRefresh in current thread --- .../hg4idea/command/mq/HgQNewCommand.java | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/command/mq/HgQNewCommand.java b/plugins/hg4idea/src/org/zmlx/hg4idea/command/mq/HgQNewCommand.java index ca0b7286a9b6..f99f82169446 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/command/mq/HgQNewCommand.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/command/mq/HgQNewCommand.java @@ -20,14 +20,12 @@ import com.intellij.openapi.vcs.VcsException; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.messages.MessageBus; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import org.zmlx.hg4idea.HgVcs; import org.zmlx.hg4idea.action.HgCommandResultNotifier; import org.zmlx.hg4idea.command.HgCommitTypeCommand; import org.zmlx.hg4idea.execution.HgCommandException; import org.zmlx.hg4idea.execution.HgCommandExecutor; import org.zmlx.hg4idea.execution.HgCommandResult; -import org.zmlx.hg4idea.execution.HgCommandResultHandler; import org.zmlx.hg4idea.repo.HgRepository; import org.zmlx.hg4idea.util.HgErrorUtil; @@ -57,7 +55,7 @@ public class HgQNewCommand extends HgCommitTypeCommand { i = 1; } for (; i < size; i++) { - executeQRefresh(chunkedCommits.get(i)); + executeQRefreshInCurrentThread(chunkedCommits.get(i)); } } myRepository.update(); @@ -65,21 +63,17 @@ public class HgQNewCommand extends HgCommitTypeCommand { messageBus.syncPublisher(HgVcs.REMOTE_TOPIC).update(myProject, null); } - private void executeQRefresh(@NotNull List chunkFiles) throws VcsException { + private void executeQRefreshInCurrentThread(@NotNull List chunkFiles) throws VcsException { List args = ContainerUtil.newArrayList(); args.add("-l"); args.add(saveCommitMessage().getAbsolutePath()); args.add("-s"); args.addAll(chunkFiles); - new HgCommandExecutor(myProject).execute(myRepository.getRoot(), "qrefresh", args, new HgCommandResultHandler() { - @Override - public void process(@Nullable HgCommandResult result) { - if (HgErrorUtil.hasErrorsInCommandExecution(result)) { - new HgCommandResultNotifier(myProject) - .notifyError(result, "QRefresh Failed", "Could not amend selected changes to newly created patch"); - } - } - }); + HgCommandResult result = new HgCommandExecutor(myProject).executeInCurrentThread(myRepository.getRoot(), "qrefresh", args); + if (HgErrorUtil.hasErrorsInCommandExecution(result)) { + new HgCommandResultNotifier(myProject) + .notifyError(result, "QRefresh Failed", "Could not amend selected changes to newly created patch"); + } } private void executeQNewInCurrentThread(@NotNull List chunkFiles) throws VcsException {