コード例 #1
0
ファイル: SVNUpdater.java プロジェクト: juancadavid/papyrus
 @Override
 protected Set<IExtendedURI> doBuild() {
   for (IExtendedURI extendedURI : getUris()) {
     IExtendedURI resourceURI = getResourceURI(extendedURI);
     if (resourceURI != null) {
       IFile file = toIFile(toResource(resourceURI.getUri()));
       if (file != null && file.exists()) {
         if (!isUpToDate(resourceURI).isUpToDate()) {
           getExtendedSet().add(resourceURI);
         }
       }
     }
   }
   return getExtendedSet();
 }
コード例 #2
0
ファイル: SVNUpdater.java プロジェクト: juancadavid/papyrus
  /**
   * Checks if is up to date.
   *
   * @param uri the uri
   * @return the i status
   */
  @Override
  public UpToDateStatus isUpToDate(IExtendedURI uri) {
    IExtendedURI resourceEURI = getResourceURI(uri);
    if (resourceEURI == null) {
      return UpToDateStatus.createErrorDuringUpToDataStatus("The URI is null");
    }
    UpToDateStatus status = getCache().get(resourceEURI);
    if (status == null) {
      URI resourceURI = resourceEURI.getUri();
      Resource resource = toResource(resourceURI);
      if (resource == null) {
        return UpToDateStatus.createErrorDuringUpToDataStatus(
            resourceURI + " is not a URI pointing to a resource");
      }
      IFile file = toIFile(resource);
      if (file == null || !file.exists()) {
        return UpToDateStatus.createErrorDuringUpToDataStatus(
            resourceURI + " is not a URI pointing to a existing file");
      }

      SVNLogEntry log = getRemoteHEADRevision(file);
      if (log == null) {
        return UpToDateStatus.createErrorDuringUpToDataStatus(
            "Unable to get remote HEAD revision for file " + file.getFullPath());
      }
      InfoOperation refreshOperation = new InfoOperation(file);
      refreshOperation.run(new NullProgressMonitor());
      SVNEntryInfo info = refreshOperation.getInfo();
      long localRevision = info.revision;
      if (log.revision > localRevision) {
        status = UpToDateStatus.createNotUpToDataStatus(log.author, log.date, log.revision);
        getCache().put(resourceEURI, status);
        return status;
      } else {
        status = UpToDateStatus.createUpToDataStatus(log.author, log.date, log.revision);
        getCache().put(resourceEURI, status);
      }
    }
    return status;
  }