private String loadContent(final TextFilePatch patch) throws ApplyPatchException {
   if (patch.isNewFile()) {
     return patch.getNewFileText();
   }
   if (patch.isDeletedFile()) {
     return null;
   }
   final GenericPatchApplier applier =
       new GenericPatchApplier(getBaseContent(), patch.getHunks());
   if (applier.execute()) {
     return applier.getAfter();
   }
   throw new ApplyPatchException("Apply patch conflict");
 }
  public ContentRevision getNewContentRevision() {
    if (FilePatchStatus.DELETED.equals(myStatus)) return null;

    if (myNewContentRevision == null) {
      myConflicts = null;
      if (FilePatchStatus.ADDED.equals(myStatus)) {
        final FilePath newFilePath =
            FilePathImpl.createNonLocal(myIoCurrentBase.getAbsolutePath(), false);
        final String content = myPatch.getNewFileText();
        myNewContentRevision =
            new SimpleContentRevision(content, newFilePath, myPatch.getAfterVersionId());
      } else {
        final FilePath newFilePath;
        if (FilePatchStatus.MOVED_OR_RENAMED.equals(myStatus)) {
          newFilePath =
              new FilePathImpl(
                  PathMerger.getFile(new File(myBase.getPath()), myPatch.getAfterName()), false);
        } else {
          newFilePath =
              (myCurrentBase != null)
                  ? new FilePathImpl(myCurrentBase)
                  : new FilePathImpl(myIoCurrentBase, false);
        }
        myNewContentRevision =
            new LazyPatchContentRevision(
                myCurrentBase, newFilePath, myPatch.getAfterVersionId(), myPatch);
        if (myCurrentBase != null) {
          ApplicationManager.getApplication()
              .executeOnPooledThread(
                  new Runnable() {
                    public void run() {
                      ((LazyPatchContentRevision) myNewContentRevision).getContent();
                    }
                  });
        }
      }
    }
    return myNewContentRevision;
  }