@CalledInAwt public void run() { myRemainingPatches.addAll(myPatches); final ApplyPatchStatus patchStatus = nonWriteActionPreCheck(); final Label beforeLabel = LocalHistory.getInstance().putSystemLabel(myProject, "Before patch"); final TriggerAdditionOrDeletion trigger = new TriggerAdditionOrDeletion(myProject); final ApplyPatchStatus applyStatus = getApplyPatchStatus(trigger); myStatus = ApplyPatchStatus.SUCCESS.equals(patchStatus) ? applyStatus : ApplyPatchStatus.and(patchStatus, applyStatus); // listeners finished, all 'legal' file additions/deletions with VCS are done trigger.processIt(); LocalHistory.getInstance() .putSystemLabel( myProject, "After patch"); // insert a label to be visible in local history dialog if (myStatus == ApplyPatchStatus.FAILURE) { suggestRollback(myProject, Collections.singletonList(PatchApplier.this), beforeLabel); } else if (myStatus == ApplyPatchStatus.ABORT) { rollbackUnderProgress(myProject, myProject.getBaseDir(), beforeLabel); } if (myShowNotification || !ApplyPatchStatus.SUCCESS.equals(myStatus)) { showApplyStatus(myProject, myStatus); } refreshFiles(trigger.getAffected()); }
@Override public void run(ContinuationContext context) { final ChangeListManager clManager = ChangeListManager.getInstance(myVcs.getProject()); final LocalChangeList changeList = clManager.getChangeList(myChange); final ApplyPatchDifferentiatedDialog dialog = new ApplyPatchDifferentiatedDialog( myVcs.getProject(), new TreeConflictApplyTheirsPatchExecutor(myVcs, context, myBaseForPatch), Collections.<ApplyPatchExecutor>singletonList( new ApplyPatchSaveToFileExecutor(myVcs.getProject(), myBaseForPatch)), ApplyPatchMode.APPLY_PATCH_IN_MEMORY, myTextPatches, changeList); context.suspend(); dialog.show(); }
@NotNull protected ChangesSelection getChangesSelection() { final Change leadSelection = ObjectUtils.tryCast(myViewer.getLeadSelection(), Change.class); List<Change> changes = getSelectedChanges(); if (changes.size() < 2) { List<Change> allChanges = getAllChanges(); if (allChanges.size() > 1 || changes.isEmpty()) { changes = allChanges; } } if (leadSelection != null) { int indexInSelection = changes.indexOf(leadSelection); if (indexInSelection == -1) { return new ChangesSelection(Collections.singletonList(leadSelection), 0); } else { return new ChangesSelection(changes, indexInSelection); } } else { return new ChangesSelection(changes, 0); } }
public void actionPerformed(AnActionEvent e) { Change change = e.getData(VcsDataKeys.CURRENT_CHANGE); askAndMove(myProject, Collections.singletonList(change), null); }
// "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)); }