ApplyPatchForBaseRevisionTexts (@NotNull String localContent, @NotNull TextFilePatch patch, @NotNull CharSequence baseContents) { final List<PatchHunk> hunks = patch.getHunks(); String base = baseContents.toString(); GenericPatchApplier.AppliedPatch appliedPatch = GenericPatchApplier.apply(base, hunks); if (appliedPatch == null) { LOG.warn(VcsBundle.message("patch.apply.wrong.base.and.can.t.be.applied.warning", chooseNotNull(patch.getBeforeName(), patch.getAfterName()))); return null; } String patched = StringUtil.convertLineSeparators(appliedPatch.patchedText); return new ApplyPatchForBaseRevisionTexts(patched, localContent, base, false); }