Java Code Examples for org.tigris.subversion.svnclientadapter.ISVNStatus#getFile()

The following examples show how to use org.tigris.subversion.svnclientadapter.ISVNStatus#getFile() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StatusUpdateStrategy.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Collect the content of unversioned folders.
 * @param statuses
 * @param recursive
 * @return
 */
protected ISVNStatus[] collectUnversionedFolders(ISVNStatus[] statuses, boolean recursive) {
	if (statuses == null) {
		return null;
	}
    List<ISVNStatus> processed = new ArrayList<ISVNStatus>();
    for (ISVNStatus status : statuses) {
    	processed.add(status);
    	if (status.getNodeKind() != SVNNodeKind.FILE && status.getTextStatus() == SVNStatusKind.UNVERSIONED) {
    		File folder = status.getFile();
    		if (!folder.isDirectory() && !folder.exists())
    			continue;
  			Set<String> alreadyProcessed = new HashSet<String>();
			processUnversionedFolder(folder, processed, recursive, alreadyProcessed);
    	}
    }

    return processed.toArray(new ISVNStatus[processed.size()]);
}
 
Example 2
Source File: SVNWorkspaceRoot.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public static IResource getResourceFor(IResource parent, ISVNStatus status) {
	if (status == null || status.getFile() == null) {
		return null;
	}
	return getResourceFor(parent, new Path(status.getFile().getAbsolutePath()));
}
 
Example 3
Source File: ResourceStatus.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
/**
 * @param status
 * @param url - Only needed when status.getUrl is Null, such as
 *  for an svn:externals folder
 */
public ResourceStatus(ISVNStatus status, String url, boolean useUrlHack) {
	super();
   	/** a temporary variable serving as immediate cache for various status values */
   	Object aValue = null;

   	aValue = status.getUrlString();
       if (aValue == null) {
       	if (url == null)
       		this.url = null;
       	else
       		this.url = url;
       } else {
           this.url = (String) aValue;
       }

       // This is a hack to get the URL for incoming additions if when URL is null due to a JavaHL bug.
       // See Issue #1312 for details.  This should only be done for RemoteResourceStatus (useUrlHack == true),
       // not LocalResourceStatus.
       if (this.url == null && useUrlHack) {
       	File file = status.getFile();
       	if (file != null) {
       		List<String> segments = new ArrayList<String>();
       		segments.add(file.getName());
       		File parentFile = file.getParentFile();
       		while (parentFile != null) {
       			if (parentFile.exists()) {
       				IContainer container = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(new Path(parentFile.getPath()));
       				if (container != null) {
						ISVNLocalFolder localFolder = SVNWorkspaceRoot.getSVNFolderFor(container);
						SVNUrl parentUrl = localFolder.getUrl();
						if (parentUrl != null) {
							StringBuffer sb = new StringBuffer(parentUrl.toString());
							for (int i = segments.size() - 1; i >= 0; i--) {
								sb.append("/" + segments.get(i));
							}
							this.url = sb.toString();
							break;
						}
       				}
       			}
       			segments.add(parentFile.getName());
       			parentFile = parentFile.getParentFile();
       		}
       	}
       }

       aValue = status.getLastChangedRevision();
       if (aValue == null) {
           this.lastChangedRevision = SVNRevision.SVN_INVALID_REVNUM;
       } else {
           this.lastChangedRevision = ((SVNRevision.Number) aValue).getNumber();
       }

       aValue = status.getLastChangedDate();
       if (aValue == null) {
           this.lastChangedDate = -1;
       } else {
           this.lastChangedDate = ((Date) aValue).getTime();
       }

       this.lastCommitAuthor = status.getLastCommitAuthor();
       this.textStatus = status.getTextStatus().toInt();
       this.propStatus = status.getPropStatus().toInt();
       this.treeConflicted = status.hasTreeConflict();
       this.fileExternal = status.isFileExternal();
       this.conflictDescriptor = status.getConflictDescriptor();

       this.nodeKind = status.getNodeKind().toInt();
       
       this.file = status.getFile();
}