From 06a7e1d503ae637a4db49bee0df30fb3e68f5830 Mon Sep 17 00:00:00 2001 From: Nadya Zabrodina Date: Thu, 6 Apr 2017 15:57:05 +0300 Subject: [PATCH] [shelf]: do not load history if the base texts are already inside patch --- .../patch/ApplyPatchForBaseRevisionTexts.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchForBaseRevisionTexts.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchForBaseRevisionTexts.java index cad1917be8bd..02fc9ed8b8e5 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchForBaseRevisionTexts.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchForBaseRevisionTexts.java @@ -70,6 +70,18 @@ public class ApplyPatchForBaseRevisionTexts { final List hunks = patch.getHunks(); + CharSequence contents = baseContents != null ? baseContents.get() : null; + if (contents != null) { + contents = StringUtil.convertLineSeparators(contents.toString()); + myBase = contents; + final GenericPatchApplier applier = new GenericPatchApplier(contents, hunks); + if (!applier.execute()) { + applier.trySolveSomehow(); + } + setPatched(applier.getAfter()); + return; + } + if (provider != null) { try { provider.getBaseVersionContent(pathBeforeRename, text -> { @@ -88,18 +100,6 @@ public class ApplyPatchForBaseRevisionTexts { if (myPatched != null) return; } - CharSequence contents = baseContents.get(); - if (contents != null) { - contents = StringUtil.convertLineSeparators(contents.toString()); - myBase = contents; - final GenericPatchApplier applier = new GenericPatchApplier(contents, hunks); - if (! applier.execute()) { - applier.trySolveSomehow(); - } - setPatched(applier.getAfter()); - return; - } - final GenericPatchApplier applier = new GenericPatchApplier(myLocal, hunks); if (! applier.execute()) { applier.trySolveSomehow();