diff --git a/platform/platform-tests/testSrc/com/intellij/history/integration/PatchingTestCase.java b/platform/platform-tests/testSrc/com/intellij/history/integration/PatchingTestCase.java index 630c2bda3d8e..25431768aa91 100644 --- a/platform/platform-tests/testSrc/com/intellij/history/integration/PatchingTestCase.java +++ b/platform/platform-tests/testSrc/com/intellij/history/integration/PatchingTestCase.java @@ -50,7 +50,7 @@ public abstract class PatchingTestCase extends IntegrationTestCase { List patches = new ArrayList<>(reader.readTextPatches()); - new PatchApplier(myProject, myRoot, patches, null, null, null).execute(); + new PatchApplier(myProject, myRoot, patches, null, null).execute(); } protected static void createChildDataWithContent(@NotNull VirtualFile dir, @NotNull String name) { diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/diff/impl/patch/ApplyPatchTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/diff/impl/patch/ApplyPatchTest.java index 026fc16bbf1a..c6afd479ede6 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/diff/impl/patch/ApplyPatchTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/diff/impl/patch/ApplyPatchTest.java @@ -209,7 +209,7 @@ public class ApplyPatchTest extends PlatformTestCase { List patches = new ArrayList<>(reader.readTextPatches()); ApplyPatchAction.applySkipDirs(patches, skipTopDirs); - final PatchApplier patchApplier = new PatchApplier(myProject, patchedDir, patches, null, null, null); + final PatchApplier patchApplier = new PatchApplier(myProject, patchedDir, patches, null, null); ApplyPatchStatus applyStatus = patchApplier.execute(false, false); assertEquals(expectedStatus, applyStatus); diff --git a/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/CustomBinaryPatchApplier.java b/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/CustomBinaryPatchApplier.java index f30389c57d9a..9fbc21011ea5 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/CustomBinaryPatchApplier.java +++ b/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/CustomBinaryPatchApplier.java @@ -15,16 +15,6 @@ */ package com.intellij.openapi.diff.impl.patch.formove; -import com.intellij.openapi.diff.impl.patch.ApplyPatchStatus; -import com.intellij.openapi.diff.impl.patch.FilePatch; -import org.jetbrains.annotations.NotNull; - -import java.io.IOException; -import java.util.List; - -public interface CustomBinaryPatchApplier { - @NotNull - ApplyPatchStatus apply(List patches) throws IOException; - @NotNull - List getAppliedPatches(); +@Deprecated +public interface CustomBinaryPatchApplier { } diff --git a/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PatchApplier.java b/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PatchApplier.java index 7a117c39ec34..fb0be6a1ab98 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PatchApplier.java +++ b/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PatchApplier.java @@ -56,12 +56,11 @@ import static com.intellij.util.ObjectUtils.chooseNotNull; /** * for patches. for shelve. */ -public class PatchApplier { +public class PatchApplier { private static final Logger LOG = Logger.getInstance(PatchApplier.class); private final Project myProject; private final VirtualFile myBaseDirectory; @NotNull private final List myPatches; - private final CustomBinaryPatchApplier myCustomForBinaries; private final CommitContext myCommitContext; @Nullable private final LocalChangeList myTargetChangeList; @NotNull private final List myRemainingPatches; @@ -76,7 +75,6 @@ public class PatchApplier { @NotNull VirtualFile baseDirectory, @NotNull List patches, @Nullable LocalChangeList targetChangeList, - @Nullable CustomBinaryPatchApplier customForBinaries, @Nullable CommitContext commitContext, boolean reverseConflict, @Nullable String leftConflictPanelTitle, @@ -85,7 +83,6 @@ public class PatchApplier { myBaseDirectory = baseDirectory; myPatches = patches; myTargetChangeList = targetChangeList; - myCustomForBinaries = customForBinaries; myCommitContext = commitContext; myReverseConflict = reverseConflict; myLeftConflictPanelTitle = leftConflictPanelTitle; @@ -103,9 +100,18 @@ public class PatchApplier { @NotNull VirtualFile baseDirectory, @NotNull List patches, @Nullable LocalChangeList targetChangeList, - @Nullable CustomBinaryPatchApplier customForBinaries, @Nullable CommitContext commitContext) { - this(project, baseDirectory, patches, targetChangeList, customForBinaries, commitContext, false, null, null); + this(project, baseDirectory, patches, targetChangeList, commitContext, false, null, null); + } + + @Deprecated + public PatchApplier(@NotNull Project project, + @NotNull VirtualFile baseDirectory, + @NotNull List patches, + @Nullable LocalChangeList targetChangeList, + @Nullable CustomBinaryPatchApplier ignored, + @Nullable CommitContext commitContext) { + this(project, baseDirectory, patches, targetChangeList, commitContext, false, null, null); } @NotNull @@ -441,17 +447,7 @@ public class PatchApplier { if (status == ApplyPatchStatus.ABORT) return status; - if (myCustomForBinaries == null) { - status = applyList(binaryPatches, context, status, commitContext); - } - else { - ApplyPatchStatus patchStatus = myCustomForBinaries.apply(binaryPatches); - final List appliedPatches = myCustomForBinaries.getAppliedPatches(); - moveForCustomBinaries(binaryPatches, appliedPatches); - - status = ApplyPatchStatus.and(status, patchStatus); - myRemainingPatches.removeAll(appliedPatches); - } + status = applyList(binaryPatches, context, status, commitContext); } catch (IOException e) { showError(myProject, e.getMessage()); @@ -460,15 +456,6 @@ public class PatchApplier { return status; } - private void moveForCustomBinaries(final List patches, - final List appliedPatches) throws IOException { - for (PatchAndFile patch : patches) { - if (appliedPatches.contains(patch.getApplyPatch().getPatch())) { - myVerifier.doMoveIfNeeded(patch.getFile()); - } - } - } - private ApplyPatchStatus applyList(final List patches, final ApplyPatchContext context, ApplyPatchStatus status, diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/RevertCommittedStuffAbstractAction.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/RevertCommittedStuffAbstractAction.java index d404c3140e6d..e953f1acc622 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/RevertCommittedStuffAbstractAction.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/RevertCommittedStuffAbstractAction.java @@ -96,7 +96,7 @@ abstract class RevertCommittedStuffAbstractAction extends AnAction implements Du @Override public void onSuccess() { - new PatchApplier(project, baseDir, patches, chooser.getSelectedList(), null, null).execute(); + new PatchApplier(project, baseDir, patches, chooser.getSelectedList(), null).execute(); } }); } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDefaultExecutor.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDefaultExecutor.java index 1b2a173a2f91..5c16c00aeb28 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDefaultExecutor.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDefaultExecutor.java @@ -69,7 +69,8 @@ public class ApplyPatchDefaultExecutor implements ApplyPatchExecutor(myProject, base, ContainerUtil - .map(patchGroups.get(base), patchInProgress -> patchInProgress.getPatch()), localList, null, commitContext)); + .map(patchGroups.get(base), patchInProgress -> patchInProgress.getPatch()), localList, + commitContext)); } return appliers; } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelveChangesManager.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelveChangesManager.java index ca926270b5d9..e540818ff006 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelveChangesManager.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelveChangesManager.java @@ -666,7 +666,7 @@ public class ShelveChangesManager extends AbstractProjectComponent implements JD ApplicationManager.getApplication().invokeAndWait(() -> { final PatchApplier patchApplier = new PatchApplier<>(myProject, myProject.getBaseDir(), - patches, targetChangeList, null, commitContext, reverse, leftConflictTitle, + patches, targetChangeList, commitContext, reverse, leftConflictTitle, rightConflictTitle); patchApplier.execute(showSuccessNotification, systemOperation); if (isRemoveFilesFromShelf() || systemOperation) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/MergeFromTheirsResolver.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/MergeFromTheirsResolver.java index b36f2ae5dcf2..da75709b6a03 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/MergeFromTheirsResolver.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/MergeFromTheirsResolver.java @@ -214,7 +214,7 @@ public class MergeFromTheirsResolver extends BackgroundTaskGroup { } if (patches != null) { - new PatchApplier(myVcs.getProject(), myBaseDir, patches, localList, null, null).execute(false, true); + new PatchApplier(myVcs.getProject(), myBaseDir, patches, localList, null).execute(false, true); myThereAreCreations = patches.stream().anyMatch(patch -> patch.isNewFile() || !Comparing.equal(patch.getAfterName(), patch.getBeforeName())); } diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/ConflictCreator.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/ConflictCreator.java index a497a7c9cac9..7a6245363ea4 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/ConflictCreator.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/ConflictCreator.java @@ -73,7 +73,7 @@ public class ConflictCreator { } if (! filePatchList.isEmpty()) { - PatchApplier applier = new PatchApplier<>(myProject, myTheirsDir, filePatchList, (LocalChangeList)null, null, null); + PatchApplier applier = new PatchApplier<>(myProject, myTheirsDir, filePatchList, (LocalChangeList)null, null); applier.setIgnoreContentRootsCheck(); applier.execute(); Assert.assertEquals(0, applier.getRemainingPatches().size());