コード例 #1
0
 private static FileStatus getFileStatusForAbsentFile(Entry entry) {
   if (entry == null || entry.isDirectory()) {
     return FileStatus.UNKNOWN;
   }
   if (entry.isRemoved()) {
     return FileStatus.DELETED;
   }
   return FileStatus.DELETED_FROM_FS;
 }
コード例 #2
0
  public static FileStatus getStatus(VirtualFile file, Entry entry) {
    if (file == null) {
      return getFileStatusForAbsentFile(entry);
    }

    if (entry == null) {
      return getFileStatusForAbsentEntry(file);
    }

    if (entry.isDirectory()) {
      return FileStatus.NOT_CHANGED;
    }

    if (entry.isAddedFile()) {
      return FileStatus.ADDED;
    }

    if (entry.isRemoved()) {
      return FileStatus.DELETED;
    }

    if (entry.isResultOfMerge()) {
      if (entry.isConflict()) {
        return FileStatus.MERGED_WITH_CONFLICTS;
      } else {
        return FileStatus.MERGE;
      }
    }

    Date revisionDate = entry.getLastModified();

    if (revisionDate == null) {
      return FileStatus.MODIFIED;
    }

    final long entryDate = revisionDate.getTime();
    final long fileDate = CvsVfsUtil.getTimeStamp(file);
    if (LOG.isDebugEnabled()) {
      LOG.debug(
          "getStatus() for "
              + file.getPath()
              + ": entry date "
              + entryDate
              + ", file date "
              + fileDate);
    }
    return (timeStampsAreEqual(entryDate, fileDate)) ? FileStatus.NOT_CHANGED : FileStatus.MODIFIED;
  }