use of org.zmlx.hg4idea.execution.HgCommandResult 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];
}
use of org.zmlx.hg4idea.execution.HgCommandResult in project intellij-community by JetBrains.
the class HgCloneDialog method test.
@NotNull
@Override
protected TestResult test(@NotNull final String url) {
HgIdentifyCommand identifyCommand = new HgIdentifyCommand(myProject);
identifyCommand.setSource(url);
HgCommandResult result = identifyCommand.execute(ModalityState.stateForComponent(getRootPane()));
return result != null && result.getExitValue() == 0 ? TestResult.SUCCESS : new TestResult(result.getRawError());
}
use of org.zmlx.hg4idea.execution.HgCommandResult in project intellij-community by JetBrains.
the class HgQNewCommand method executeQNewInCurrentThread.
private void executeQNewInCurrentThread(@NotNull List<String> chunkFiles) throws VcsException {
List<String> args = ContainerUtil.newArrayList();
args.add("-l");
args.add(saveCommitMessage().getAbsolutePath());
args.add("-UD");
String patchName = DATE_FORMAT.format(new Date()).concat(".diff");
args.add(patchName);
args.addAll(chunkFiles);
HgCommandExecutor executor = new HgCommandExecutor(myProject);
HgCommandResult result = executor.executeInCurrentThread(myRepository.getRoot(), "qnew", args);
if (HgErrorUtil.hasErrorsInCommandExecution(result)) {
new HgCommandResultNotifier(myProject).notifyError(result, "Qnew Failed", "Could not create mq patch for selected changes");
}
}
use of org.zmlx.hg4idea.execution.HgCommandResult in project intellij-community by JetBrains.
the class HgQPopCommand method executeInCurrentThread.
public HgCommandResult executeInCurrentThread() {
final Project project = myRepository.getProject();
HgCommandResult result = new HgCommandExecutor(project).executeInCurrentThread(myRepository.getRoot(), "qpop", Collections.singletonList("--all"));
if (HgErrorUtil.hasErrorsInCommandExecution(result)) {
new HgCommandResultNotifier(project).notifyError(result, "QPop command failed", "Could not make all patches unapplied");
} else {
assert result != null;
if (!result.getErrorLines().isEmpty()) {
VcsNotifier.getInstance(project).notifyWarning("QPop completed with errors", result.getRawError());
}
}
myRepository.update();
return result;
}
use of org.zmlx.hg4idea.execution.HgCommandResult in project intellij-community by JetBrains.
the class HgHistoryUtil method readAllHashes.
@NotNull
public static List<TimedVcsCommit> readAllHashes(@NotNull Project project, @NotNull VirtualFile root, @NotNull final Consumer<VcsUser> userRegistry, @NotNull List<String> params) throws VcsException {
final VcsLogObjectsFactory factory = getObjectsFactoryWithDisposeCheck(project);
if (factory == null) {
return Collections.emptyList();
}
HgVcs hgvcs = HgVcs.getInstance(project);
assert hgvcs != null;
HgVersion version = hgvcs.getVersion();
String[] templates = ArrayUtil.toStringArray(HgBaseLogParser.constructDefaultTemplate(version));
HgCommandResult result = getLogResult(project, root, version, -1, params, HgChangesetUtil.makeTemplate(templates));
return getCommitRecords(project, result, new HgBaseLogParser<TimedVcsCommit>() {
@Override
protected TimedVcsCommit convertDetails(@NotNull String rev, @NotNull String changeset, @NotNull SmartList<HgRevisionNumber> parents, @NotNull Date revisionDate, @NotNull String author, @NotNull String email, @NotNull List<String> attributes) {
List<Hash> parentsHash = new SmartList<>();
for (HgRevisionNumber parent : parents) {
parentsHash.add(factory.createHash(parent.getChangeset()));
}
userRegistry.consume(factory.createUser(author, email));
return factory.createTimedCommit(factory.createHash(changeset), parentsHash, revisionDate.getTime());
}
});
}
Aggregations