@Override public void run(final ContinuationContext context) { final int result = Messages.showYesNoCancelDialog( myProject, "Merge all?", myTitle, "Merge &all", "&Select revisions to merge", "Cancel", Messages.getQuestionIcon()); if (result == 2) return; if (result == 0) { insertMergeAll(context); return; } final MergeCalculator calculator; try { calculator = new MergeCalculator(myWcInfo, mySourceUrl, myBranchName); } catch (SVNException e) { finishWithError(context, e.getMessage(), true); return; } context.next( myVcs .getSvnBranchPointsCalculator() .getFirstCopyPointTask( myWcInfo.getRepositoryRoot(), myWcInfo.getRootUrl(), mySourceUrl, calculator), calculator); }
@Override public void run(ContinuationContext context) { final SVNURL sourceUrlUrl; try { sourceUrlUrl = SVNURL.parseURIEncoded(mySourceUrl); } catch (SVNException e) { finishWithError(context, "Cannot merge: " + e.getMessage(), true); return; } context.next( new TaskDescriptor(getName(), Where.POOLED) { @Override public void run(ContinuationContext context) { final SvnIntegrateChangesTask task = new SvnIntegrateChangesTask( SvnVcs.getInstance(myProject), new WorkingCopyInfo(myWcInfo.getPath(), true), myFactory, sourceUrlUrl, getName(), false, myBranchName); RunBackgroundable.run(task); } }); createChangelist(context); }
// 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); } }); }
@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); } }); }
@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); } }
@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)); } }
@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)); }
@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: } }
// "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)); }
private void insertMergeAll(final ContinuationContext context) { final List<TaskDescriptor> queue = new LinkedList<TaskDescriptor>(); insertMergeAll(queue); context.next(queue); }