@CalledInAwt public void execute() { FileDocumentManager.getInstance().saveAllDocuments(); final List<TaskDescriptor> tasks = new LinkedList<TaskDescriptor>(); tasks.add(new MyInitChecks()); tasks.add(new SourceUrlCorrection()); tasks.add(new CheckRepositorySupportsMergeinfo()); myContinuation.run(tasks); }
private void insertMergeAll(final List<TaskDescriptor> queue) { queue.add(new LocalChangesPrompt(true, null, null)); final MergeAllWithBranchCopyPoint mergeAllExecutor = new MergeAllWithBranchCopyPoint(); queue.add( myVcs .getSvnBranchPointsCalculator() .getFirstCopyPointTask( myWcInfo.getRepositoryRoot(), mySourceUrl, myWcInfo.getRootUrl(), mergeAllExecutor)); queue.add(mergeAllExecutor); }
@Override public void run(ContinuationContext context) { try { final List<TaskDescriptor> tasks = new LinkedList<TaskDescriptor>(); final boolean supportsMergeinfo = myWcInfo.getFormat().supportsMergeInfo() && SvnUtil.doesRepositorySupportMergeinfo( myVcs, SVNURL.parseURIEncoded(mySourceUrl)); if (!supportsMergeinfo) { insertMergeAll(tasks); } else { tasks.add(new MergeAllOrSelectedChooser()); } context.next(tasks); } catch (SVNException e) { finishWithError(context, e.getMessage(), true); } }
@Nullable private Intersection checkIntersection( @Nullable final List<CommittedChangeList> lists, List<LocalChangeList> localChangeLists) { if (lists == null || lists.isEmpty()) { return null; } final Set<FilePath> mergePaths = new HashSet<FilePath>(); for (CommittedChangeList list : lists) { final SvnChangeList svnList = (SvnChangeList) list; final List<String> paths = new ArrayList<String>(svnList.getAddedPaths()); paths.addAll(svnList.getChangedPaths()); paths.addAll(svnList.getDeletedPaths()); for (String path : paths) { final File localPath = getLocalPath(path); if (localPath != null) { mergePaths.add(new FilePathImpl(localPath, false)); } } } final Intersection intersection = new Intersection(); for (LocalChangeList localChangeList : localChangeLists) { final Collection<Change> localChanges = localChangeList.getChanges(); for (Change localChange : localChanges) { final FilePath before = localChange.getBeforeRevision() == null ? null : localChange.getBeforeRevision().getFile(); final FilePath after = localChange.getAfterRevision() == null ? null : localChange.getAfterRevision().getFile(); if ((before != null && mergePaths.contains(before)) || (after != null && mergePaths.contains(after))) { intersection.add(localChangeList.getName(), localChangeList.getComment(), localChange); } } } return intersection; }
@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)); } }
// "Calculating not merged revisions" @Override public void run(ContinuationContext context) { if (myCopyData == null) { finishWithError(context, "Merge start wasn't found", true); return; } final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator(); myIsReintegrate = myCopyData.isInvertedSense(); if (!myWcInfo.getFormat().supportsMergeInfo()) return; final SvnBranchPointsCalculator.BranchCopyData data = myCopyData.getTrue(); final long sourceLatest = data.getTargetRevision(); final SvnCommittedChangesProvider committedChangesProvider = (SvnCommittedChangesProvider) myVcs.getCommittedChangesProvider(); final ChangeBrowserSettings settings = new ChangeBrowserSettings(); settings.CHANGE_AFTER = Long.toString(sourceLatest); settings.USE_CHANGE_AFTER_FILTER = true; String local = SVNPathUtil.getRelativePath(myWcInfo.getRepositoryRoot(), myWcInfo.getRootUrl()); final String relativeLocal = (local.startsWith("/") ? local : "/" + local); final LinkedList<Pair<SvnChangeList, TreeStructureNode<SVNLogEntry>>> list = new LinkedList<Pair<SvnChangeList, TreeStructureNode<SVNLogEntry>>>(); try { committedChangesProvider.getCommittedChangesWithMergedRevisons( settings, new SvnRepositoryLocation(mySourceUrl), 0, new PairConsumer<SvnChangeList, TreeStructureNode<SVNLogEntry>>() { public void consume(SvnChangeList svnList, TreeStructureNode<SVNLogEntry> tree) { indicator.checkCanceled(); if (sourceLatest >= svnList.getNumber()) return; list.add(new Pair<SvnChangeList, TreeStructureNode<SVNLogEntry>>(svnList, tree)); } }); } catch (VcsException e) { finishWithError( context, "Checking revisions for merge fault", Collections.singletonList(e)); } indicator.setText("Checking merge information..."); // to do not go into file system while asking something on the net for (Pair<SvnChangeList, TreeStructureNode<SVNLogEntry>> pair : list) { final SvnChangeList svnList = pair.getFirst(); final SvnMergeInfoCache.MergeCheckResult checkResult = myMergeChecker.checkList(svnList); indicator.setText2("Processing revision " + svnList.getNumber()); if (SvnMergeInfoCache.MergeCheckResult.NOT_MERGED.equals(checkResult)) { // additionally check for being 'local' final List<TreeStructureNode<SVNLogEntry>> children = pair.getSecond().getChildren(); boolean localChange = false; for (TreeStructureNode<SVNLogEntry> child : children) { if (isLocalRevisionMergeIteration(child, relativeLocal, indicator)) { localChange = true; break; } } if (!localChange) { myNotMerged.add(svnList); } } } if (myNotMerged.isEmpty()) { finishWithError(context, "Everything is up-to-date", false); return; } context.next(new ShowRevisionSelector(myCopyData)); }