Exemplo n.º 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;
   }
 }
Exemplo n.º 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));
  }
Exemplo n.º 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();
     }
   };
 }
Exemplo n.º 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);
    }
  }
Exemplo n.º 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);
  }
Exemplo n.º 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);
                  }
                });
          }
        });
  }
Exemplo n.º 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);
    }
  }
Exemplo n.º 8
0
 public boolean is18() {
   return myMergeContext.getWcInfo().getFormat().isOrGreater(ONE_DOT_EIGHT);
 }
Exemplo n.º 9
0
 @Override
 public void showErrors() {
   if (!myExceptions.isEmpty()) {
     myInteraction.showErrors(myMergeContext.getTitle(), myExceptions);
   }
 }
Exemplo n.º 10
0
 public QuickMerge(
     @NotNull MergeContext mergeContext, @NotNull QuickMergeInteraction interaction) {
   super(mergeContext.getProject(), mergeContext.getTitle());
   myMergeContext = mergeContext;
   myInteraction = interaction;
 }
Exemplo n.º 11
0
 private boolean supportsMergeInfo() {
   return myMergeContext.getWcInfo().getFormat().supportsMergeInfo()
       && checkRepositoryVersion15(myMergeContext.getVcs(), myMergeContext.getSourceUrl());
 }