private static @NotNull ApplyFilePatch.Result tryApplyPatch(@NotNull Project project,
                                                              @NotNull ApplyFilePatchBase<?> patch,
                                                              @Nullable ApplyPatchContext context,
                                                              @NotNull VirtualFile file,
                                                              @Nullable CommitContext commitContext) {
    FilePatch patchBase = patch.getPatch();
    return WriteAction.compute(() -> {
      try {
        return patch.apply(file, context, project, VcsUtil.getFilePath(file), () -> {
          String path = ObjectUtils.chooseNotNull(patchBase.getBeforeName(), patchBase.getAfterName());
          return BaseRevisionTextPatchEP.getBaseContent(project, path, commitContext);
        }, commitContext);
      }
      catch (IOException e) {
        LOG.warn(e);
        return ApplyFilePatch.FAILURE;
      }
    });
  }
private static @NotNull ApplyFilePatch.Result tryApplyPatch(@NotNull Project project,
                                                              @NotNull ApplyFilePatchBase<?> patch,
                                                              @Nullable ApplyPatchContext context,
                                                              @NotNull VirtualFile file,
                                                              @Nullable CommitContext commitContext)