svn: Moved "MergeCalculatorTask.myMergeChecker" preparation to pooled thread
authorKonstantin Kolosovsky <konstantin.kolosovsky@jetbrains.com>
Fri, 30 Sep 2016 14:01:54 +0000 (17:01 +0300)
committerKonstantin Kolosovsky <konstantin.kolosovsky@jetbrains.com>
Tue, 11 Oct 2016 01:28:23 +0000 (04:28 +0300)
plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergeAllOrSelectedChooserTask.java
plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergeCalculatorTask.java

index d0d24332658ff0c9c3f02b35afca98e0ac677b1c..192847bc27bd29186ac317c5f7c9d6ee7907867f 100644 (file)
  */
 package org.jetbrains.idea.svn.integrate;
 
-import com.intellij.openapi.vcs.VcsException;
 import com.intellij.util.continuation.TaskDescriptor;
 import com.intellij.util.continuation.Where;
 import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
 
 public class MergeAllOrSelectedChooserTask extends BaseMergeTask {
 
@@ -41,11 +39,8 @@ public class MergeAllOrSelectedChooserTask extends BaseMergeTask {
         next(loader, dialog);
         break;
       case select:
-        MergeCalculatorTask calculator = getMergeCalculatorTask();
-
-        if (calculator != null) {
-          next(getCalculateFirstCopyPointTask(calculator), calculator);
-        }
+        MergeCalculatorTask calculator = new MergeCalculatorTask(myMergeProcess);
+        next(getCalculateFirstCopyPointTask(calculator), calculator);
         break;
     }
   }
@@ -56,18 +51,4 @@ public class MergeAllOrSelectedChooserTask extends BaseMergeTask {
       .getFirstCopyPointTask(myMergeContext.getWcInfo().getRepositoryRoot(), myMergeContext.getWcInfo().getRootUrl(),
                              myMergeContext.getSourceUrl(), mergeCalculator);
   }
-
-  @Nullable
-  private MergeCalculatorTask getMergeCalculatorTask() {
-    MergeCalculatorTask result = null;
-
-    try {
-      result = new MergeCalculatorTask(myMergeProcess);
-    }
-    catch (VcsException e) {
-      end(e);
-    }
-
-    return result;
-  }
 }
index b0976aa134229e98845c7dd53acaf707229ce616..0d4ac8ee30945fb02efa48e3302d8e76fa572913 100644 (file)
@@ -53,22 +53,23 @@ public class MergeCalculatorTask extends BaseMergeTask
     myCopyData.set(value);
   }
 
-  public MergeCalculatorTask(@NotNull QuickMerge mergeProcess) throws VcsException {
+  public MergeCalculatorTask(@NotNull QuickMerge mergeProcess) {
     super(mergeProcess, "Calculating not merged revisions", Where.POOLED);
 
     // TODO: Previously it was configurable - either to use OneShotMergeInfoHelper or BranchInfo as merge checker, but later that logic
     // TODO: was commented (in 80ebdbfea5210f6c998e67ddf28ca9c670fa4efe on 5/28/2010).
     // TODO: Still check if we need to preserve such configuration or it is sufficient to always use OneShotMergeInfoHelper.
     myMergeChecker = new OneShotMergeInfoHelper(myMergeContext);
-    myMergeChecker.prepare();
     myCopyData = new AtomicReference<>();
   }
 
   @Override
-  public void run() {
+  public void run() throws VcsException {
     SvnBranchPointsCalculator.WrapperInvertor copyPoint = getCopyPoint();
 
     if (copyPoint != null && myMergeContext.getWcInfo().getFormat().supportsMergeInfo()) {
+      myMergeChecker.prepare();
+
       List<Pair<SvnChangeList, LogHierarchyNode>> afterCopyPointChangeLists =
         getChangeListsAfter(copyPoint.getTrue().getTargetRevision());
       List<CommittedChangeList> notMergedChangeLists = getNotMergedChangeLists(afterCopyPointChangeLists);