Projects >> intellij-community >>91dc1cf28eaad251d794c222b6d40f47936384b9

Chunk
Conflicting content
                                                "You also may abort rebase to restore the original branch and stop rebasing.");
  }

<<<<<<< HEAD
  private static class MyConflictResolver extends GitConflictResolver {
    private final GitRebaser myRebaser;
    private final VirtualFile myRoot;

    public MyConflictResolver(Project project, @NotNull Git git, VirtualFile root, GitRebaser rebaser) {
=======
  @NotNull
  public GitUpdateResult handleRebaseFailure(@NotNull GitLineHandler handler, @NotNull VirtualFile root,
                                             @NotNull GitRebaseProblemDetector rebaseConflictDetector,
                                             @NotNull GitMessageWithFilesDetector untrackedWouldBeOverwrittenDetector) {
    if (rebaseConflictDetector.isMergeConflict()) {
      LOG.info("handleRebaseFailure merge conflict");
      final boolean allMerged = new GitRebaser.ConflictResolver(myProject, myGit, root, this).merge();
      return allMerged ? GitUpdateResult.SUCCESS_WITH_RESOLVED_CONFLICTS : GitUpdateResult.INCOMPLETE;
    } else if (untrackedWouldBeOverwrittenDetector.wasMessageDetected()) {
      LOG.info("handleRebaseFailure: untracked files would be overwritten by checkout");
      UntrackedFilesNotifier.notifyUntrackedFilesOverwrittenBy(myProject, ServiceManager.getService(myProject, GitPlatformFacade.class),
                                                               untrackedWouldBeOverwrittenDetector.getFiles(), "rebase", null);
      return GitUpdateResult.ERROR;
    } else {
      LOG.info("handleRebaseFailure error " + handler.errors());
      GitUIUtil.notifyImportantError(myProject, "Rebase error", GitUIUtil.stringifyErrors(handler.errors()));
      return GitUpdateResult.ERROR;
    }
  }

  public static class ConflictResolver extends GitConflictResolver {
    @NotNull private final GitRebaser myRebaser;
    @NotNull private final VirtualFile myRoot;

    public ConflictResolver(@NotNull Project project, @NotNull Git git, @NotNull VirtualFile root, @NotNull GitRebaser rebaser) {
>>>>>>> ab61ad180dfbb5fc59d2f46dedd7ba086228d0b5
      super(project, git, ServiceManager.getService(GitPlatformFacade.class), Collections.singleton(root), makeParams());
      myRebaser = rebaser;
      myRoot = root;
Solution content
                                                "You also may abort rebase to restore the original branch and stop rebasing.");
  }

  private static class MyConflictResolver extends GitConflictResolver {
    private final GitRebaser myRebaser;
    private final VirtualFile myRoot;

    public MyConflictResolver(Project project, @NotNull Git git, VirtualFile root, GitRebaser rebaser) {
      super(project, git, ServiceManager.getService(GitPlatformFacade.class), Collections.singleton(root), makeParams());
      myRebaser = rebaser;
      myRoot = root;
    }

    private static Params makeParams() {
      Params params = new Params();
      params.setReverse(true);
      params.setMergeDescription("Merge conflicts detected. Resolve them before continuing rebase.");
      params.setErrorNotificationTitle("Can't continue rebase");
      params.setErrorNotificationAdditionalDescription("Then you may continue rebase. 
You also may abort rebase to restore the original branch and stop rebasing."); return params; } @Override protected boolean proceedIfNothingToMerge() throws VcsException { return myRebaser.continueRebase(myRoot); } @Override protected boolean proceedAfterAllMerged() throws VcsException { return myRebaser.continueRebase(myRoot); } } public static class TrivialEditor extends GitInteractiveRebaseEditorHandler{ public TrivialEditor(@NotNull GitRebaseEditorService service, @NotNull Project project, @NotNull VirtualFile root, @NotNull GitHandler handler) { super(service, project, root, handler); } @Override public int editCommits(String path) { return 0; } } @NotNull public GitUpdateResult handleRebaseFailure(@NotNull GitLineHandler handler, @NotNull VirtualFile root, @NotNull GitRebaseProblemDetector rebaseConflictDetector, @NotNull GitMessageWithFilesDetector untrackedWouldBeOverwrittenDetector) { if (rebaseConflictDetector.isMergeConflict()) { LOG.info("handleRebaseFailure merge conflict"); final boolean allMerged = new GitRebaser.ConflictResolver(myProject, myGit, root, this).merge(); return allMerged ? GitUpdateResult.SUCCESS_WITH_RESOLVED_CONFLICTS : GitUpdateResult.INCOMPLETE; } else if (untrackedWouldBeOverwrittenDetector.wasMessageDetected()) { LOG.info("handleRebaseFailure: untracked files would be overwritten by checkout"); UntrackedFilesNotifier.notifyUntrackedFilesOverwrittenBy(myProject, ServiceManager.getService(myProject, GitPlatformFacade.class), untrackedWouldBeOverwrittenDetector.getFiles(), "rebase", null); return GitUpdateResult.ERROR; } else { LOG.info("handleRebaseFailure error " + handler.errors()); GitUIUtil.notifyImportantError(myProject, "Rebase error", GitUIUtil.stringifyErrors(handler.errors())); return GitUpdateResult.ERROR; } } public static class ConflictResolver extends GitConflictResolver { @NotNull private final GitRebaser myRebaser; @NotNull private final VirtualFile myRoot; public ConflictResolver(@NotNull Project project, @NotNull Git git, @NotNull VirtualFile root, @NotNull GitRebaser rebaser) { super(project, git, ServiceManager.getService(GitPlatformFacade.class), Collections.singleton(root), makeParams()); myRebaser = rebaser; myRoot = root;
File
GitRebaser.java
Developer's decision
Manual
Kind of conflict
Annotation
Attribute
Class signature
Method declaration
Method signature
Chunk
Conflicting content
    }
  }

<<<<<<< HEAD
  public static class TrivialEditor extends GitInteractiveRebaseEditorHandler{
    public TrivialEditor(@NotNull GitRebaseEditorService service,
                         @NotNull Project project,
                         @NotNull VirtualFile root,
                         @NotNull GitHandler handler) {
      super(service, project, root, handler);
    }

    @Override
    public int editCommits(String path) {
      return 0;
    }
  }

=======
>>>>>>> ab61ad180dfbb5fc59d2f46dedd7ba086228d0b5
  /**
   * The rebase editor that just overrides the list of commits
   */
Solution content
    }
  }

  /**
   * The rebase editor that just overrides the list of commits
   */
File
GitRebaser.java
Developer's decision
Version 2
Kind of conflict
Class declaration
Chunk
Conflicting content
  }

  @NotNull
<<<<<<< HEAD
  List getRepositories();

  boolean moreThanOneRoot();

  /**
   * Synchronously updates the specified information about Git repository under the given root.
   * @param root   root directory of the Git repository.
   *
   */
  void updateRepository(VirtualFile root);

  void updateAllRepositories();

  void waitUntilInitialized();
=======
  @Override
  protected GitRepository createRepository(@NotNull VirtualFile root) {
    return GitRepositoryImpl.getFullInstance(root, myProject, myPlatformFacade, this);
  }
>>>>>>> ab61ad180dfbb5fc59d2f46dedd7ba086228d0b5
}
Solution content
  }

  @NotNull
  @Override
  protected GitRepository createRepository(@NotNull VirtualFile root) {
    return GitRepositoryImpl.getFullInstance(root, myProject, myPlatformFacade, this);
  }

}
File
GitRepositoryManager.java
Developer's decision
Version 2
Kind of conflict
Annotation
Comment
Method declaration
Method interface
Chunk
Conflicting content
import git4idea.GitUtil;
import git4idea.Notificator;
import git4idea.branch.GitBranchPair;
<<<<<<< HEAD
import git4idea.commands.Git;
import git4idea.commands.GitCommandResult;
=======
import git4idea.commands.*;
import git4idea.rebase.GitRebaseProblemDetector;
>>>>>>> ab61ad180dfbb5fc59d2f46dedd7ba086228d0b5
import git4idea.rebase.GitRebaser;
import git4idea.repo.GitRepository;
import org.jetbrains.annotations.NotNull;
Solution content
import git4idea.GitUtil;
import git4idea.Notificator;
import git4idea.branch.GitBranchPair;
import git4idea.commands.Git;
import git4idea.commands.GitCommandResult;
import git4idea.rebase.GitRebaser;
import git4idea.repo.GitRepository;
import org.jetbrains.annotations.NotNull;
File
GitRebaseUpdater.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
      public void run() {
        cancel();
      }
<<<<<<< HEAD
    }, null);
=======

      @Override
      protected void onFailure() {
        failure.set(true);
      }
    });

    if (failure.get()) {
      updateResult.set(myRebaser.handleRebaseFailure(rebaseHandler, myRoot, rebaseConflictDetector, untrackedFilesDetector));
    }
    return updateResult.get();
>>>>>>> ab61ad180dfbb5fc59d2f46dedd7ba086228d0b5
  }

  @NotNull
Solution content
      public void run() {
        cancel();
      }
    }, null);
  }

  @NotNull
File
GitRebaseUpdater.java
Developer's decision
Version 1
Kind of conflict
Annotation
If statement
Method declaration
Method invocation
Return statement