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); }
// "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 String formatWc(WCInfo info) { final StringBuilder sb = new StringBuilder() .append("<html><head>") .append(UIUtil.getCssFontDeclaration(UIUtil.getLabelFont())) .append("</head><body><table bgColor=\"") .append(ColorUtil.toHex(UIUtil.getPanelBackground())) .append("\">"); sb.append("<tr valign=\"top\"><td colspan=\"3\"><b>") .append(info.getPath()) .append("</b></td></tr>"); sb.append("<tr valign=\"top\"><td>URL:</td><td colspan=\"2\">") .append(info.getRootUrl()) .append("</td></tr>"); if (!WorkingCopyFormat.ONE_DOT_SEVEN.equals(info.getFormat())) { // can convert sb.append("<tr valign=\"top\"><td>Format:</td><td>") .append(info.getFormat().getName()) .append("</td><td><a href=\"") .append(CHANGE_FORMAT) .append("\">Change</a></td></tr>"); } else { sb.append("<tr valign=\"top\"><td>Format:</td><td colspan=\"2\">") .append(info.getFormat().getName()) .append("</td></tr>"); } if (!SVNDepth.INFINITY.equals(info.getStickyDepth())) { // can fix sb.append("<tr valign=\"top\"><td>Depth:</td><td>") .append(info.getStickyDepth().getName()) .append("</td><td><a href=\"") .append(FIX_DEPTH) .append("\">Fix</a></td></tr>"); } else { sb.append("<tr valign=\"top\"><td>Depth:</td><td colspan=\"2\">") .append(info.getStickyDepth().getName()) .append("</td></tr>"); } final NestedCopyType type = info.getType(); if (NestedCopyType.external.equals(type) || NestedCopyType.switched.equals(type)) { sb.append("<tr valign=\"top\"><td colspan=\"3\"><i>") .append(type.getName()) .append("</i></td></tr>"); } if (info.isIsWcRoot()) { sb.append("<tr valign=\"top\"><td colspan=\"3\"><i>") .append("Working copy root</i></td></tr>"); } sb.append("<tr valign=\"top\"><td colspan=\"3\"><a href=\"") .append(CONFIGURE_BRANCHES) .append("\">Configure Branches</a></td></tr>"); sb.append("<tr valign=\"top\"><td colspan=\"3\"><a href=\"") .append(MERGE_FROM) .append("\"><b>Merge From...</b></a></i></td></tr>"); sb.append("</table></body></html>"); return sb.toString(); }
@SuppressWarnings("MethodMayBeStatic") private String formatWc( @NotNull WCInfo info, @NotNull Collection<WorkingCopyFormat> upgradeFormats) { final StringBuilder sb = new StringBuilder() .append("<html><head>") .append(UIUtil.getCssFontDeclaration(UIUtil.getLabelFont())) .append("</head><body><table bgColor=\"") .append(ColorUtil.toHex(UIUtil.getPanelBackground())) .append("\">"); sb.append("<tr valign=\"top\"><td colspan=\"3\"><b>") .append(info.getPath()) .append("</b></td></tr>"); if (info.hasError()) { sb.append("<tr valign=\"top\"><td>URL:</td><td colspan=\"2\" color=\"") .append(ColorUtil.toHex(JBColor.red)) .append("\">") .append(info.getErrorMessage()) .append("</td></tr>"); } else { sb.append("<tr valign=\"top\"><td>URL:</td><td colspan=\"2\">") .append(info.getRootUrl()) .append("</td></tr>"); } if (upgradeFormats.size() > 1) { sb.append("<tr valign=\"top\"><td>Format:</td><td>") .append(info.getFormat().getName()) .append("</td><td><a href=\"") .append(CHANGE_FORMAT) .append("\">Change</a></td></tr>"); } else { sb.append("<tr valign=\"top\"><td>Format:</td><td colspan=\"2\">") .append(info.getFormat().getName()) .append("</td></tr>"); } if (!Depth.INFINITY.equals(info.getStickyDepth()) && !info.hasError()) { // can fix sb.append("<tr valign=\"top\"><td>Depth:</td><td>") .append(info.getStickyDepth().getName()) .append("</td><td><a href=\"") .append(FIX_DEPTH) .append("\">Fix</a></td></tr>"); } else { sb.append("<tr valign=\"top\"><td>Depth:</td><td colspan=\"2\">") .append(info.getStickyDepth().getName()) .append("</td></tr>"); } final NestedCopyType type = info.getType(); if (NestedCopyType.external.equals(type) || NestedCopyType.switched.equals(type)) { sb.append("<tr valign=\"top\"><td colspan=\"3\"><i>") .append(type.getName()) .append("</i></td></tr>"); } if (info.isIsWcRoot()) { sb.append("<tr valign=\"top\"><td colspan=\"3\"><i>") .append("Working copy root</i></td></tr>"); } if (!info.hasError()) { if (info.getFormat().isOrGreater(WorkingCopyFormat.ONE_DOT_SEVEN)) { sb.append("<tr valign=\"top\"><td colspan=\"3\"><a href=\"") .append(CLEANUP) .append("\">Cleanup</a></td></tr>"); } sb.append("<tr valign=\"top\"><td colspan=\"3\"><a href=\"") .append(CONFIGURE_BRANCHES) .append("\">Configure Branches</a></td></tr>"); sb.append("<tr valign=\"top\"><td colspan=\"3\"><a href=\"") .append(MERGE_FROM) .append("\"><b>Merge From...</b></a></i></td></tr>"); sb.append("</table></body></html>"); } return sb.toString(); }