Search in sources :

Example 1 with HgGraftCommand

use of org.zmlx.hg4idea.command.HgGraftCommand in project intellij-community by JetBrains.

the class HgCherryPicker method processGrafting.

private static void processGrafting(@NotNull HgRepository repository, @NotNull List<String> hashes) {
    Project project = repository.getProject();
    VirtualFile root = repository.getRoot();
    HgGraftCommand command = new HgGraftCommand(project, repository);
    HgCommandResult result = command.startGrafting(hashes);
    boolean hasConflicts = HgConflictResolver.hasConflicts(project, root);
    if (!hasConflicts && HgErrorUtil.isCommandExecutionFailed(result)) {
        new HgCommandResultNotifier(project).notifyError(result, "Hg Error", "Couldn't  graft.");
        return;
    }
    final UpdatedFiles updatedFiles = UpdatedFiles.create();
    while (hasConflicts) {
        new HgConflictResolver(project, updatedFiles).resolve(root);
        hasConflicts = HgConflictResolver.hasConflicts(project, root);
        if (!hasConflicts) {
            result = command.continueGrafting();
            hasConflicts = HgConflictResolver.hasConflicts(project, root);
        } else {
            new HgCommandResultNotifier(project).notifyError(result, "Hg Error", "Couldn't continue grafting");
            break;
        }
    }
    repository.update();
    root.refresh(true, true);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) HgCommandResult(org.zmlx.hg4idea.execution.HgCommandResult) Project(com.intellij.openapi.project.Project) HgGraftCommand(org.zmlx.hg4idea.command.HgGraftCommand) UpdatedFiles(com.intellij.openapi.vcs.update.UpdatedFiles) HgCommandResultNotifier(org.zmlx.hg4idea.action.HgCommandResultNotifier) HgConflictResolver(org.zmlx.hg4idea.provider.update.HgConflictResolver)

Aggregations

Project (com.intellij.openapi.project.Project)1 UpdatedFiles (com.intellij.openapi.vcs.update.UpdatedFiles)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 HgCommandResultNotifier (org.zmlx.hg4idea.action.HgCommandResultNotifier)1 HgGraftCommand (org.zmlx.hg4idea.command.HgGraftCommand)1 HgCommandResult (org.zmlx.hg4idea.execution.HgCommandResult)1 HgConflictResolver (org.zmlx.hg4idea.provider.update.HgConflictResolver)1