ApplyPatchForBaseRevisionTexts (@NotNull Project project, @NotNull String localContent, @NotNull TextFilePatch patch, @NotNull String beforeVersionId, @NotNull VirtualFile file, @NotNull FilePath pathBeforeRename) { try { List<PatchHunk> hunks = patch.getHunks(); Ref<String> baseRef = new Ref<>(); Ref<String> patchedRef = new Ref<>(); DefaultPatchBaseVersionProvider.getBaseVersionContent(project, beforeVersionId, file, pathBeforeRename, base -> { GenericPatchApplier.AppliedPatch appliedPatch = GenericPatchApplier.apply(base, hunks); if (appliedPatch == null) return true; baseRef.set(base); patchedRef.set(StringUtil.convertLineSeparators(appliedPatch.patchedText)); return false; }); String base = baseRef.get(); String patched = patchedRef.get(); if (base == null || patched == null) return null; return new ApplyPatchForBaseRevisionTexts(patched, localContent, base, false); } catch (VcsException e) { LOG.warn(e); return null; } }