@Override
 public String getAnnotatedContent() {
   try {
     return CurrentContentRevision.create(myFile.toFilePath()).getContent();
   } catch (VcsException e) {
     LOG.info(e);
     return "";
   }
 }
示例#2
0
  private Change getChange(GitVirtualFile file) {
    if (file == null) return null;
    ContentRevision beforeRev =
        new GitContentRevision(
            file,
            new GitRevisionNumber(GitRevisionNumber.TIP, new Date(file.getModificationStamp())),
            project);
    ContentRevision afterRev = CurrentContentRevision.create(VcsUtil.getFilePath(file.getPath()));

    Change c = null;
    switch (file.getStatus()) {
      case UNMERGED:
        {
          c = new Change(beforeRev, afterRev, FileStatus.MERGED_WITH_CONFLICTS);
          break;
        }
      case ADDED:
        {
          c = new Change(null, afterRev, FileStatus.ADDED);
          break;
        }
      case DELETED:
        {
          c = new Change(beforeRev, null, FileStatus.DELETED);
          break;
        }
      case COPY:
      case RENAME:
      case MODIFIED:
        {
          c = new Change(beforeRev, afterRev, FileStatus.MODIFIED);
          break;
        }
      case UNMODIFIED:
        {
          break;
        }
      case IGNORED:
        {
          c = new Change(null, afterRev, FileStatus.IGNORED);
          break;
        }
      case UNVERSIONED:
      default:
        {
          c = new Change(null, afterRev, FileStatus.UNKNOWN);
        }
    }
    return c;
  }