Search in sources :

Example 16 with HgCommandResultNotifier

use of org.zmlx.hg4idea.action.HgCommandResultNotifier 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");
    }
}
Also used : HgCommandResult(org.zmlx.hg4idea.execution.HgCommandResult) HgCommandExecutor(org.zmlx.hg4idea.execution.HgCommandExecutor) HgCommandResultNotifier(org.zmlx.hg4idea.action.HgCommandResultNotifier) Date(java.util.Date)

Example 17 with HgCommandResultNotifier

use of org.zmlx.hg4idea.action.HgCommandResultNotifier 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;
}
Also used : HgCommandResult(org.zmlx.hg4idea.execution.HgCommandResult) Project(com.intellij.openapi.project.Project) HgCommandExecutor(org.zmlx.hg4idea.execution.HgCommandExecutor) HgCommandResultNotifier(org.zmlx.hg4idea.action.HgCommandResultNotifier)

Example 18 with HgCommandResultNotifier

use of org.zmlx.hg4idea.action.HgCommandResultNotifier 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();
}
Also used : HgCommandResult(org.zmlx.hg4idea.execution.HgCommandResult) Project(com.intellij.openapi.project.Project) HgCommandExecutor(org.zmlx.hg4idea.execution.HgCommandExecutor) HgCommandResultNotifier(org.zmlx.hg4idea.action.HgCommandResultNotifier)

Example 19 with HgCommandResultNotifier

use of org.zmlx.hg4idea.action.HgCommandResultNotifier 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();
}
Also used : HgCommandResult(org.zmlx.hg4idea.execution.HgCommandResult) Project(com.intellij.openapi.project.Project) HgCommandExecutor(org.zmlx.hg4idea.execution.HgCommandExecutor) HgCommandResultNotifier(org.zmlx.hg4idea.action.HgCommandResultNotifier)

Example 20 with HgCommandResultNotifier

use of org.zmlx.hg4idea.action.HgCommandResultNotifier in project intellij-community by JetBrains.

the class HgBookmarkCommand method executeBookmarkCommandSynchronously.

private static void executeBookmarkCommandSynchronously(@NotNull Project project, @NotNull VirtualFile repositoryRoot, @NotNull String name, @NotNull List<String> args) {
    ArrayList<String> arguments = ContainerUtil.newArrayList(args);
    arguments.add(name);
    HgCommandResult result = new HgCommandExecutor(project).executeInCurrentThread(repositoryRoot, "bookmark", arguments);
    getRepositoryManager(project).updateRepository(repositoryRoot);
    if (HgErrorUtil.hasErrorsInCommandExecution(result)) {
        new HgCommandResultNotifier(project).notifyError(result, "Hg Error", String.format("Hg bookmark command failed for repository %s with name %s ", repositoryRoot.getName(), name));
    }
}
Also used : HgCommandResult(org.zmlx.hg4idea.execution.HgCommandResult) HgCommandExecutor(org.zmlx.hg4idea.execution.HgCommandExecutor) HgCommandResultNotifier(org.zmlx.hg4idea.action.HgCommandResultNotifier)

Aggregations

HgCommandResultNotifier (org.zmlx.hg4idea.action.HgCommandResultNotifier)20 HgCommandResult (org.zmlx.hg4idea.execution.HgCommandResult)19 HgCommandExecutor (org.zmlx.hg4idea.execution.HgCommandExecutor)11 Project (com.intellij.openapi.project.Project)9 VirtualFile (com.intellij.openapi.vfs.VirtualFile)4 File (java.io.File)2 HgCommandResultHandler (org.zmlx.hg4idea.execution.HgCommandResultHandler)2 HgRemoteCommandExecutor (org.zmlx.hg4idea.execution.HgRemoteCommandExecutor)2 HgConflictResolver (org.zmlx.hg4idea.provider.update.HgConflictResolver)2 Notification (com.intellij.notification.Notification)1 NotificationListener (com.intellij.notification.NotificationListener)1 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 Task (com.intellij.openapi.progress.Task)1 VcsException (com.intellij.openapi.vcs.VcsException)1 VcsNotifier (com.intellij.openapi.vcs.VcsNotifier)1 MergeData (com.intellij.openapi.vcs.merge.MergeData)1 UpdatedFiles (com.intellij.openapi.vcs.update.UpdatedFiles)1 VcsRunnable (com.intellij.vcsUtil.VcsRunnable)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1