示例#1
0
    @Override
    public void run(ContinuationContext continuationContext) {
      if (SVNPathUtil.isAncestor(mySourceUrl, myWcInfo.getRootUrl())
          || SVNPathUtil.isAncestor(myWcInfo.getRootUrl(), mySourceUrl)) {
        finishWithError(continuationContext, "Cannot merge from self", true);
        return;
      }

      if (!checkForSwitchedRoots()) {
        continuationContext.cancelEverything();
      }
    }
示例#2
0
 // todo can be a very base class!
 @CalledInAny
 private void finishWithError(
     final ContinuationContext context, final String message, final boolean isError) {
   context.cancelEverything();
   context.next(
       new TaskDescriptor(message, Where.AWT) {
         @Override
         public void run(ContinuationContext context) {
           VcsBalloonProblemNotifier.showOverChangesView(
               myProject, message, isError ? MessageType.ERROR : MessageType.WARNING);
         }
       });
 }
示例#3
0
 @CalledInAny
 private void finishWithError(
     final ContinuationContext context,
     final String message,
     final List<VcsException> exceptions) {
   context.cancelEverything();
   context.next(
       new TaskDescriptor(message, Where.AWT) {
         @Override
         public void run(ContinuationContext context) {
           AbstractVcsHelper.getInstance(myProject).showErrors(exceptions, message);
         }
       });
 }
示例#4
0
 @Override
 public void run(ContinuationContext context) {
   final ToBeMergedDialog dialog =
       new ToBeMergedDialog(myProject, myNotMerged, myMergeTitle, myMergeChecker);
   dialog.show();
   if (dialog.getExitCode() == DialogWrapper.CANCEL_EXIT_CODE) {
     context.cancelEverything();
     return;
   }
   if (dialog.getExitCode() == ToBeMergedDialog.MERGE_ALL_CODE) {
     insertMergeAll(context);
   } else {
     final List<CommittedChangeList> lists = dialog.getSelected();
     if (lists.isEmpty()) return;
     final MergerFactory factory =
         new ChangeListsMergerFactory(lists) {
           @Override
           public IMerger createMerger(
               SvnVcs vcs,
               File target,
               UpdateEventHandler handler,
               SVNURL currentBranchUrl,
               String branchName) {
             return new GroupMerger(
                 vcs,
                 lists,
                 target,
                 handler,
                 currentBranchUrl,
                 branchName,
                 false,
                 false,
                 false);
           }
         };
     context.next(
         new LocalChangesPrompt(false, lists, myCopyPoint),
         new MergeTask(factory, myMergeTitle));
   }
 }
示例#5
0
    @Override
    public void run(ContinuationContext context) {
      if (myData == null) {
        finishWithError(context, "Merge start wasn't found", true);
        return;
      }
      final boolean reintegrate = myData.isInvertedSense();
      if (reintegrate
          && (!prompt(
              "<html><body>You are going to reintegrate changes.<br><br>This will make branch '"
                  + mySourceUrl
                  + "' <b>no longer usable for further work</b>."
                  + "<br>It will not be able to correctly absorb new trunk ("
                  + myData.inverted().getTarget()
                  + ") changes,<br>nor can this branch be properly reintegrated to trunk again.<br><br>Are you sure?</body></html>"))) {
        context.cancelEverything();
        return;
      }
      final MergerFactory mergerFactory = createBranchMergerFactory(reintegrate);

      final String title =
          "Merging all from " + myBranchName + (reintegrate ? " (reintegrate)" : "");
      context.next(new MergeTask(mergerFactory, title));
    }
示例#6
0
    @Override
    public void run(ContinuationContext context) {
      final String message;
      final Intersection intersection;
      final ChangeListManager listManager = ChangeListManager.getInstance(myProject);
      final List<LocalChangeList> localChangeLists = listManager.getChangeListsCopy();

      if (myMergeAll) {
        intersection = getMergeAllIntersection(localChangeLists);
        message =
            "There are local changes that can potentially intersect with merge changes.\nDo you want to continue?";
      } else {
        intersection = checkIntersection(myLists, localChangeLists);
        message =
            "There are local changes that will intersect with merge changes.\nDo you want to continue?";
      }
      if (intersection == null || intersection.getChangesSubset().isEmpty()) return;

      final LocalChangesAction action;
      if (!myMergeAll) {
        final LocalChangesAction[] possibleResults = {
          LocalChangesAction.shelve,
          LocalChangesAction.inspect,
          LocalChangesAction.continueMerge,
          LocalChangesAction.cancel
        };
        final int result =
            Messages.showDialog(
                message,
                myTitle,
                new String[] {
                  "Shelve local changes", "Inspect changes", "Continue merge", "Cancel"
                },
                0,
                Messages.getQuestionIcon());
        action = possibleResults[result];
      } else {
        final LocalChangesAction[] possibleResults = {
          LocalChangesAction.shelve, LocalChangesAction.continueMerge, LocalChangesAction.cancel
        };
        final int result =
            Messages.showDialog(
                message,
                myTitle,
                new String[] {"Shelve local changes", "Continue merge", "Cancel"},
                0,
                Messages.getQuestionIcon());
        action = possibleResults[result];
      }
      switch (action) {
          // shelve
        case shelve:
          context.next(new ShelveLocalChanges(intersection));
          return;
          // cancel
        case cancel:
          context.cancelEverything();
          return;
          // continue
        case continueMerge:
          return;
          // inspect
        case inspect:
          final Collection<Change> changes =
              (Collection<Change>) intersection.getChangesSubset().values();
          final List<FilePath> paths = ChangesUtil.getPaths(changes);
          Collections.sort(paths, FilePathByPathComparator.getInstance());
          // todo rework message
          IntersectingLocalChangesPanel.showInVersionControlToolWindow(
              myProject,
              myTitle + ", local changes intersection",
              paths,
              "The following file(s) have local changes that will intersect with merge changes:");
          context.cancelEverything();
          return;
        default:
      }
    }