Пример #1
0
 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;
   }
 }
Пример #2
0
  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));
  }
Пример #3
0
 @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();
     }
   };
 }
Пример #4
0
  private void merge(@NotNull List<SvnChangeList> changeLists) {
    if (!changeLists.isEmpty()) {
      ChangeListsMergerFactory mergerFactory =
          new ChangeListsMergerFactory(changeLists, false, false, true);

      merge(myMergeContext.getTitle(), mergerFactory, changeLists);
    }
  }
Пример #5
0
  @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);
  }
Пример #6
0
  @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);
                  }
                });
          }
        });
  }
Пример #7
0
  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);
    }
  }
Пример #8
0
 public boolean is18() {
   return myMergeContext.getWcInfo().getFormat().isOrGreater(ONE_DOT_EIGHT);
 }
Пример #9
0
 @Override
 public void showErrors() {
   if (!myExceptions.isEmpty()) {
     myInteraction.showErrors(myMergeContext.getTitle(), myExceptions);
   }
 }
Пример #10
0
 public QuickMerge(
     @NotNull MergeContext mergeContext, @NotNull QuickMergeInteraction interaction) {
   super(mergeContext.getProject(), mergeContext.getTitle());
   myMergeContext = mergeContext;
   myInteraction = interaction;
 }
Пример #11
0
 private boolean supportsMergeInfo() {
   return myMergeContext.getWcInfo().getFormat().supportsMergeInfo()
       && checkRepositoryVersion15(myMergeContext.getVcs(), myMergeContext.getSourceUrl());
 }