use of org.zmlx.hg4idea.execution.HgCommandResultHandler in project intellij-community by JetBrains.
the class HgQFinishCommand method execute.
public void execute(@NotNull final String revision) {
final Project project = myRepository.getProject();
new HgCommandExecutor(project).execute(myRepository.getRoot(), "qfinish", Collections.singletonList("qbase:" + revision), new HgCommandResultHandler() {
@Override
public void process(@Nullable HgCommandResult result) {
if (HgErrorUtil.hasErrorsInCommandExecution(result)) {
new HgCommandResultNotifier(project).notifyError(result, "QFinish command failed", "Could not apply patches into repository history.");
}
myRepository.update();
}
});
}
use of org.zmlx.hg4idea.execution.HgCommandResultHandler in project intellij-community by JetBrains.
the class HgInitCommand method executeAsynchronously.
public void executeAsynchronously(@NotNull VirtualFile repositoryRoot, final HgCommandResultHandler resultHandler) {
final List<String> args = new ArrayList<>(1);
args.add(repositoryRoot.getPath());
final HgCommandExecutor executor = new HgCommandExecutor(myProject, repositoryRoot.getPath());
executor.setShowOutput(true);
executor.execute(null, "init", args, new HgCommandResultHandler() {
@Override
public void process(@Nullable HgCommandResult result) {
resultHandler.process(result);
}
});
}
use of org.zmlx.hg4idea.execution.HgCommandResultHandler in project intellij-community by JetBrains.
the class HgResolveCommand method getListAsynchronously.
public void getListAsynchronously(final VirtualFile repo, final Consumer<Map<HgFile, HgResolveStatusEnum>> resultHandler) {
if (repo == null) {
resultHandler.consume(Collections.emptyMap());
}
final HgCommandExecutor executor = new HgCommandExecutor(myProject);
executor.setSilent(true);
executor.execute(repo, "resolve", Collections.singletonList("--list"), new HgCommandResultHandler() {
@Override
public void process(@Nullable HgCommandResult result) {
if (result == null) {
resultHandler.consume(Collections.emptyMap());
}
final Map<HgFile, HgResolveStatusEnum> resolveStatus = handleResult(repo, result);
resultHandler.consume(resolveStatus);
}
});
}
use of org.zmlx.hg4idea.execution.HgCommandResultHandler in project intellij-community by JetBrains.
the class HgQRenameCommand method performPatchRename.
public static void performPatchRename(@NotNull final HgRepository repository, @NotNull final String oldName, @NotNull final String newName) {
if (oldName.equals(newName))
return;
final Project project = repository.getProject();
new HgCommandExecutor(project).execute(repository.getRoot(), "qrename", Arrays.asList(oldName, newName), new HgCommandResultHandler() {
@Override
public void process(@Nullable HgCommandResult result) {
if (HgErrorUtil.hasErrorsInCommandExecution(result)) {
new HgCommandResultNotifier(project).notifyError(result, "Qrename command failed", "Could not rename patch " + oldName + " to " + newName);
}
repository.update();
}
});
}
use of org.zmlx.hg4idea.execution.HgCommandResultHandler in project intellij-community by JetBrains.
the class HgIntegrationEnabler method initOrNotifyError.
@Override
protected boolean initOrNotifyError(@NotNull final VirtualFile projectDir) {
final boolean[] success = new boolean[1];
new HgInitCommand(myProject).executeAsynchronously(projectDir, new HgCommandResultHandler() {
@Override
public void process(@Nullable HgCommandResult result) {
VcsNotifier notifier = VcsNotifier.getInstance(myProject);
if (!HgErrorUtil.hasErrorsInCommandExecution(result)) {
success[0] = true;
refreshVcsDir(projectDir, HgUtil.DOT_HG);
notifier.notifySuccess(message("hg4idea.init.created.notification.title"), message("hg4idea.init.created.notification.description", projectDir.getPresentableUrl()));
} else {
success[0] = false;
String errors = result != null ? result.getRawError() : "";
notifier.notifyError(message("hg4idea.init.error.description", projectDir.getPresentableUrl()), errors);
}
}
});
return success[0];
}
Aggregations