[shelf]: do not load history if the base texts are already inside patch

This commit is contained in:
Nadya Zabrodina
2017-05-17 17:22:44 +03:00
parent 140109f1eb
commit 06a7e1d503
@@ -70,6 +70,18 @@ public class ApplyPatchForBaseRevisionTexts {
final List<PatchHunk> 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();