use of org.zmlx.hg4idea.action.HgCommandResultNotifier in project intellij-community by JetBrains.
the class HgQPushCommand method executeInCurrentThread.
public void executeInCurrentThread(@NotNull final String patchName) {
final Project project = myRepository.getProject();
HgCommandResult result = new HgCommandExecutor(project).executeInCurrentThread(myRepository.getRoot(), "qpush", Arrays.asList("--move", patchName));
if (HgErrorUtil.hasErrorsInCommandExecution(result)) {
new HgCommandResultNotifier(project).notifyError(result, "QPush command failed", "Could not apply selected patch " + patchName);
}
myRepository.update();
}
use of org.zmlx.hg4idea.action.HgCommandResultNotifier 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.action.HgCommandResultNotifier in project intellij-community by JetBrains.
the class HgRegularUpdater method processRebase.
private void processRebase(ProgressIndicator indicator, final UpdatedFiles updatedFiles) throws VcsException {
indicator.setText2(HgVcsMessages.message("hg4idea.progress.rebase"));
HgRepository repository = HgUtil.getRepositoryManager(project).getRepositoryForRoot(repoRoot);
if (repository == null) {
throw new VcsException("Repository not found for root " + repoRoot);
}
HgRebaseCommand rebaseCommand = new HgRebaseCommand(project, repository);
HgCommandResult result = new HgRebaseCommand(project, repository).startRebase();
if (HgErrorUtil.isCommandExecutionFailed(result)) {
new HgCommandResultNotifier(project).notifyError(result, "Hg Error", "Couldn't rebase repository.");
return;
}
//noinspection ConstantConditions
while (result.getExitValue() == 1) {
//if result == null isAbort will be true;
resolvePossibleConflicts(updatedFiles);
if (HgConflictResolver.hasConflicts(project, repoRoot) || HgErrorUtil.isNothingToRebase(result)) {
break;
}
result = rebaseCommand.continueRebase();
if (HgErrorUtil.isAbort(result)) {
new HgCommandResultNotifier(project).notifyError(result, "Hg Error", "Couldn't continue rebasing");
break;
}
}
repository.update();
repoRoot.refresh(true, true);
}
use of org.zmlx.hg4idea.action.HgCommandResultNotifier in project intellij-community by JetBrains.
the class HgCheckoutProvider method doCheckout.
public void doCheckout(@NotNull final Project project, @Nullable final Listener listener) {
FileDocumentManager.getInstance().saveAllDocuments();
final HgCloneDialog dialog = new HgCloneDialog(project);
if (!dialog.showAndGet()) {
return;
}
dialog.rememberSettings();
VirtualFile destinationParent = LocalFileSystem.getInstance().findFileByIoFile(new File(dialog.getParentDirectory()));
if (destinationParent == null) {
return;
}
final String targetDir = destinationParent.getPath() + File.separator + dialog.getDirectoryName();
final String sourceRepositoryURL = dialog.getSourceRepositoryURL();
final AtomicReference<HgCommandResult> cloneResult = new AtomicReference<>();
new Task.Backgroundable(project, HgVcsMessages.message("hg4idea.clone.progress", sourceRepositoryURL), true) {
@Override
public void run(@NotNull ProgressIndicator indicator) {
HgCloneCommand clone = new HgCloneCommand(project);
clone.setRepositoryURL(sourceRepositoryURL);
clone.setDirectory(targetDir);
cloneResult.set(clone.executeInCurrentThread());
}
@Override
public void onSuccess() {
if (cloneResult.get() == null || HgErrorUtil.hasErrorsInCommandExecution(cloneResult.get())) {
new HgCommandResultNotifier(project).notifyError(cloneResult.get(), "Clone failed", "Clone from " + sourceRepositoryURL + " failed.");
} else {
DvcsUtil.addMappingIfSubRoot(project, targetDir, HgVcs.VCS_NAME);
if (listener != null) {
listener.directoryCheckedOut(new File(dialog.getParentDirectory(), dialog.getDirectoryName()), HgVcs.getKey());
listener.checkoutCompleted();
}
}
}
}.queue();
}
use of org.zmlx.hg4idea.action.HgCommandResultNotifier in project intellij-community by JetBrains.
the class HgErrorUtil method handleException.
public static void handleException(@Nullable Project project, @NotNull String title, @NotNull Exception e) {
LOG.info(e);
new HgCommandResultNotifier(project).notifyError(null, title, e.getMessage());
}
Aggregations