@NotNull
  private DiffRequest createTextShelveRequest(@NotNull ShelvedChange shelvedChange,
                                              @NotNull UserDataHolder context,
                                              @Nullable @Nls String title)
    throws VcsException {
    DiffContentFactoryEx factory = DiffContentFactoryEx.getInstanceEx();

    PatchesPreloader preloader = PatchesPreloader.getPatchesPreloader(myProject, context);
    Pair<TextFilePatch, CommitContext> pair = preloader.getPatchWithContext(shelvedChange);
    TextFilePatch patch = pair.first;
    CommitContext commitContext = pair.second;

    FilePath contextFilePath = getContextFilePath(shelvedChange);

    String leftTitle = DiffBundle.message("merge.version.title.base");
    String rightTitle = VcsBundle.message("shelve.shelved.version");

    if (patch.isDeletedFile() || patch.isNewFile()) {
      DiffContent shelfContent = factory.create(myProject, patch.getSingleHunkPatchText(), contextFilePath);
      DiffContent emptyContent = factory.createEmpty();

      DiffContent leftContent = patch.isDeletedFile() ? shelfContent : emptyContent;
      DiffContent rightContent = !patch.isDeletedFile() ? shelfContent : emptyContent;

      return new SimpleDiffRequest(title, leftContent, rightContent, leftTitle, rightTitle);
    }

    String path = chooseNotNull(patch.getAfterName(), patch.getBeforeName());
    CharSequence baseContents = BaseRevisionTextPatchEP.getBaseContent(myProject, path, commitContext);
    if (baseContents != null) {
      String patchedContent = PlainSimplePatchApplier.apply(baseContents, patch.getHunks());
      if (patchedContent != null) {
        DiffContent leftContent = factory.create(myProject, baseContents.toString(), contextFilePath);
        DiffContent rightContent = factory.create(myProject, patchedContent, contextFilePath);

        return new SimpleDiffRequest(title, leftContent, rightContent, leftTitle, rightTitle);
      }
    }

    return new PatchDiffRequest(patch, title, leftTitle, rightTitle);
  }
@NotNull
  private DiffRequest createTextShelveRequest(@NotNull ShelvedChange shelvedChange,
                                              @NotNull UserDataHolder context,
                                              @Nullable @Nls String title)