[hg]: execute QRefresh in current thread

This commit is contained in:
Nadya Zabrodina
2016-03-09 14:29:26 +03:00
parent b9b5f0b5ee
commit e479b24e05
@@ -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<String> chunkFiles) throws VcsException {
private void executeQRefreshInCurrentThread(@NotNull List<String> chunkFiles) throws VcsException {
List<String> 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<String> chunkFiles) throws VcsException {