@NotNull
  public static MergeRequest createBadMergeRequest(@Nullable Project project,
                                                   @NotNull Document document,
                                                   @Nullable VirtualFile file,
                                                   @NotNull String localContent,
                                                   @NotNull AppliedTextPatch textPatch,
                                                   @Nullable @NlsContexts.DialogTitle String windowTitle,
                                                   @Nullable @NlsContexts.Label String localTitle,
                                                   @Nullable @NlsContexts.Label String resultTitle,
                                                   @Nullable @NlsContexts.Label String patchTitle,
                                                   @Nullable Consumer<? super MergeResult> callback)
    throws InvalidDiffRequestException {
    if (!DiffUtil.canMakeWritable(document)) {
      throw new InvalidDiffRequestException("Output is read only" + (file != null ? " : '" + file.getPresentableUrl() +"'": ""));
    }

    if (windowTitle == null) windowTitle = getBadPatchTitle(file);
    if (localTitle == null) localTitle = VcsBundle.message("patch.apply.conflict.local.version");
    if (resultTitle == null) resultTitle = VcsBundle.message("patch.apply.conflict.patched.somehow.version");
    if (patchTitle == null) patchTitle = VcsBundle.message("patch.apply.conflict.patch");

    DocumentContent resultContent = DiffContentFactory.getInstance().create(project, document, file);
    ApplyPatchMergeRequest request = new ApplyPatchMergeRequest(project, resultContent, textPatch, localContent,
                                                                windowTitle, localTitle, resultTitle, patchTitle);
    return MergeCallback.register(request, callback);
  }
@NotNull
  public static MergeRequest createBadMergeRequest(@Nullable Project project,
                                                   @NotNull Document document,
                                                   @Nullable VirtualFile file,
                                                   @NotNull String localContent,
                                                   @NotNull AppliedTextPatch textPatch,
                                                   @Nullable @NlsContexts.DialogTitle String windowTitle,
                                                   @Nullable @NlsContexts.Label String localTitle,
                                                   @Nullable @NlsContexts.Label String resultTitle,
                                                   @Nullable @NlsContexts.Label String patchTitle,
                                                   @Nullable Consumer<? super MergeResult> callback)