private void selectMergeVariant() {
   switch (myInteraction.selectMergeVariant()) {
     case all:
       mergeAll(true);
       break;
     case showLatest:
       runInBackground(
           "Loading recent " + myMergeContext.getBranchName() + " revisions",
           new MergeCalculatorTask(
               this, null, task -> runInEdt(() -> selectRevisionsToMerge(task, false))));
       break;
     case select:
       runInBackground(
           "Looking for branch origin",
           new LookForBranchOriginTask(
               this,
               false,
               copyPoint ->
                   runInBackground(
                       "Filtering " + myMergeContext.getBranchName() + " revisions",
                       new MergeCalculatorTask(
                           this,
                           copyPoint,
                           task -> runInEdt(() -> selectRevisionsToMerge(task, true))))));
     case cancel:
       break;
   }
 }
  private boolean hasSwitchedRoots() {
    File currentRoot = myMergeContext.getWcInfo().getRootInfo().getIoFile();

    return myMergeContext
        .getVcs()
        .getAllWcInfos()
        .stream()
        .filter(info -> NestedCopyType.switched.equals(info.getType()))
        .anyMatch(info -> FileUtil.isAncestor(currentRoot, info.getRootInfo().getIoFile(), true));
  }
 @NotNull
 private Task newIntegrateTask(@NotNull String title, @NotNull MergerFactory mergerFactory) {
   return new SvnIntegrateChangesTask(
       myMergeContext.getVcs(),
       new WorkingCopyInfo(myMergeContext.getWcInfo().getPath(), true),
       mergerFactory,
       parseUrl(myMergeContext.getSourceUrl()),
       title,
       false,
       myMergeContext.getBranchName()) {
     @Override
     public void onFinished() {
       super.onFinished();
       mySemaphore.up();
     }
   };
 }
  private void merge(@NotNull List<SvnChangeList> changeLists) {
    if (!changeLists.isEmpty()) {
      ChangeListsMergerFactory mergerFactory =
          new ChangeListsMergerFactory(changeLists, false, false, true);

      merge(myMergeContext.getTitle(), mergerFactory, changeLists);
    }
  }
  @NotNull
  private MergerFactory createMergeAllFactory(
      boolean reintegrate, @Nullable WrapperInvertor copyPoint, boolean supportsMergeInfo) {
    long revision =
        copyPoint != null
            ? reintegrate
                ? copyPoint.getWrapped().getTargetRevision()
                : copyPoint.getWrapped().getSourceRevision()
            : -1;

    return (vcs, target, handler, currentBranchUrl, branchName) ->
        new BranchMerger(
            vcs,
            currentBranchUrl,
            myMergeContext.getWcInfo().getPath(),
            handler,
            reintegrate,
            myMergeContext.getBranchName(),
            revision,
            supportsMergeInfo);
  }
  @CalledInAwt
  public void execute() {
    FileDocumentManager.getInstance().saveAllDocuments();

    mySemaphore.down();
    runInEdt(
        () -> {
          if (areInSameHierarchy(
              createUrl(myMergeContext.getSourceUrl()), myMergeContext.getWcInfo().getUrl())) {
            end("Cannot merge from self", true);
          } else if (!hasSwitchedRoots() || myInteraction.shouldContinueSwitchedRootFound()) {
            runInBackground(
                "Checking repository capabilities",
                indicator -> {
                  if (supportsMergeInfo()) {
                    runInEdt(this::selectMergeVariant);
                  } else {
                    mergeAll(false);
                  }
                });
          }
        });
  }
  private void checkReintegrateIsAllowedAndMergeAll(
      @Nullable WrapperInvertor copyPoint, boolean supportsMergeInfo) {
    boolean reintegrate = copyPoint != null && copyPoint.isInvertedSense();

    if (!reintegrate || myInteraction.shouldReintegrate(copyPoint.inverted().getTarget())) {
      MergerFactory mergerFactory =
          createMergeAllFactory(reintegrate, copyPoint, supportsMergeInfo);
      String title =
          "Merging all from "
              + myMergeContext.getBranchName()
              + (reintegrate ? " (reintegrate)" : "");

      merge(title, mergerFactory, null);
    }
  }
 public boolean is18() {
   return myMergeContext.getWcInfo().getFormat().isOrGreater(ONE_DOT_EIGHT);
 }
 @Override
 public void showErrors() {
   if (!myExceptions.isEmpty()) {
     myInteraction.showErrors(myMergeContext.getTitle(), myExceptions);
   }
 }
 public QuickMerge(
     @NotNull MergeContext mergeContext, @NotNull QuickMergeInteraction interaction) {
   super(mergeContext.getProject(), mergeContext.getTitle());
   myMergeContext = mergeContext;
   myInteraction = interaction;
 }
 private boolean supportsMergeInfo() {
   return myMergeContext.getWcInfo().getFormat().supportsMergeInfo()
       && checkRepositoryVersion15(myMergeContext.getVcs(), myMergeContext.getSourceUrl());
 }