use of org.zmlx.hg4idea.execution.HgCommandResult in project intellij-community by JetBrains.
the class HgLogProvider method readFullDetails.
@Override
public void readFullDetails(@NotNull VirtualFile root, @NotNull List<String> hashes, @NotNull Consumer<VcsFullCommitDetails> commitConsumer) throws VcsException {
// this method currently is very slow and time consuming
// so indexing is not to be used for mercurial for now
HgVcs hgvcs = HgVcs.getInstance(myProject);
assert hgvcs != null;
final HgVersion version = hgvcs.getVersion();
final String[] templates = HgBaseLogParser.constructFullTemplateArgument(true, version);
HgCommandResult logResult = HgHistoryUtil.getLogResult(myProject, root, version, -1, HgHistoryUtil.prepareHashes(hashes), HgChangesetUtil.makeTemplate(templates));
if (logResult == null)
return;
if (!logResult.getErrorLines().isEmpty())
throw new VcsException(logResult.getRawError());
HgHistoryUtil.createFullCommitsFromResult(myProject, root, logResult, version, false).forEach(commitConsumer::consume);
}
use of org.zmlx.hg4idea.execution.HgCommandResult in project intellij-community by JetBrains.
the class HgUpdateCommand method execute.
@Nullable
public HgCommandResult execute() {
List<String> arguments = new LinkedList<>();
if (clean) {
arguments.add("--clean");
}
if (!StringUtil.isEmptyOrSpaces(revision)) {
arguments.add("--rev");
arguments.add(revision);
}
final HgPromptCommandExecutor executor = new HgPromptCommandExecutor(project);
executor.setShowOutput(true);
HgCommandResult result;
AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
try {
result = executor.executeInCurrentThread(repo, "update", arguments);
if (!clean && hasUncommittedChangesConflict(result)) {
final String message = "<html>Your uncommitted changes couldn't be merged into the requested changeset.<br>" + "Would you like to perform force update and discard them?";
if (showDiscardChangesConfirmation(project, message) == Messages.OK) {
arguments.add("-C");
result = executor.executeInCurrentThread(repo, "update", arguments);
}
}
} finally {
token.finish();
}
VfsUtil.markDirtyAndRefresh(false, true, false, repo);
return result;
}
use of org.zmlx.hg4idea.execution.HgCommandResult in project intellij-community by JetBrains.
the class HgQDeleteCommand method executeInCurrentThread.
public void executeInCurrentThread(@NotNull final List<String> patchNames) {
final Project project = myRepository.getProject();
HgCommandResult result = new HgCommandExecutor(project).executeInCurrentThread(myRepository.getRoot(), "qdelete", patchNames);
if (HgErrorUtil.hasErrorsInCommandExecution(result)) {
new HgCommandResultNotifier(project).notifyError(result, "QDelete command failed", "Could not delete selected " + StringUtil.pluralize("patch", patchNames.size()));
}
myRepository.update();
}
use of org.zmlx.hg4idea.execution.HgCommandResult in project intellij-community by JetBrains.
the class HgQFoldCommand method executeInCurrentThread.
public void executeInCurrentThread(@NotNull final List<String> patchNames) {
final Project project = myRepository.getProject();
HgCommandResult result = new HgCommandExecutor(project).executeInCurrentThread(myRepository.getRoot(), "qfold", patchNames);
if (HgErrorUtil.hasErrorsInCommandExecution(result)) {
new HgCommandResultNotifier(project).notifyError(result, "QFold command failed", "Could not fold patches into the current patch");
}
myRepository.update();
}
Aggregations