Java Code Examples for org.tigris.subversion.svnclientadapter.SVNStatusKind#DELETED

The following examples show how to use org.tigris.subversion.svnclientadapter.SVNStatusKind#DELETED . 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: SVNStatusSyncInfo.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
private static IResourceVariant createLatestResourceVariant(IResource local, LocalResourceStatus baseStatusInfo, RemoteResourceStatus remoteStatusInfo) {
    if( remoteStatusInfo == null
            || remoteStatusInfo.getStatusKind() == SVNStatusKind.DELETED )
        return null;
    if( remoteStatusInfo.getStatusKind() == SVNStatusKind.NONE && 
        baseStatusInfo != null && isAddition(baseStatusInfo.getStatusKind()) ) {
        return null;
    }

    if( local.getType() == IResource.FILE ) {
        return new RemoteFile(remoteStatusInfo);
    }
    else {
        return new RemoteFolder(remoteStatusInfo);
    }
}
 
Example 2
Source File: SvnClientJavaHl.java    From MergeProcessor with Apache License 2.0 5 votes vote down vote up
/**
 * Checks the given {@link ISVNStatus} if modifications exist.
 * 
 * @param status the {@link ISVNStatus}
 * @return {@code true} if modifications exist
 */
private static boolean isModified(ISVNStatus status) {
	final SVNStatusKind textStatus = status.getTextStatus();
	if (textStatus == SVNStatusKind.ADDED || textStatus == SVNStatusKind.CONFLICTED
			|| textStatus == SVNStatusKind.DELETED || textStatus == SVNStatusKind.MERGED
			|| textStatus == SVNStatusKind.MODIFIED || textStatus == SVNStatusKind.REPLACED) {
		return true;
	} else {
		final SVNStatusKind propStatus = status.getPropStatus();
		return propStatus == SVNStatusKind.ADDED || propStatus == SVNStatusKind.CONFLICTED
				|| propStatus == SVNStatusKind.DELETED || propStatus == SVNStatusKind.MERGED
				|| propStatus == SVNStatusKind.MODIFIED || propStatus == SVNStatusKind.REPLACED;
	}
}
 
Example 3
Source File: ResourceWithStatusUtil.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public static SVNStatusKind getStatusKind(IResource resource) {
	ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
	SVNStatusKind statusKind = null;
       try {
           LocalResourceStatus status = svnResource.getStatus();
	       if (status.isTextConflicted())
	    	   statusKind = SVNStatusKind.CONFLICTED;
	       else	            
            if (status.isAdded())
               statusKind = SVNStatusKind.ADDED;
              else
              if (status.isDeleted())
           	   statusKind = SVNStatusKind.DELETED;
              else
       	   if (status.isMissing())
       		   statusKind = SVNStatusKind.MISSING;
       	   else
       	   if (status.isReplaced())
       		   statusKind = SVNStatusKind.REPLACED;
       	   else
              if (status.isTextModified())
           	   statusKind = SVNStatusKind.MODIFIED;			           
              else
              if (!status.isManaged())
           	   statusKind = SVNStatusKind.UNVERSIONED;
       } catch (TeamException e) {}
	return statusKind;
}
 
Example 4
Source File: UpdateSynchronizeOperation.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * This method returns the highest revision number in the set of items
 * being updated or SVNRevision.HEAD if there are deleted items
 * 
 * @param resources - the resources being updated
 * @param set - the list of all selected items in synch view
 * @return
 */
private SVNRevision getRevisionForUpdate(IResource[] resources, SyncInfoSet set) {
	SVNRevision revision = null;
	final SyncInfo[] syncInfos = set.getSyncInfos();
	boolean useHEAD = false;
	syncInfoLoop:
	for (int i = 0; i < syncInfos.length; i++) {
		SVNStatusSyncInfo syncInfo = (SVNStatusSyncInfo)syncInfos[i];
		resourceLoop:
		for (int j = 0; j < resources.length; j++) {
			if (resources[j].equals(syncInfo.getLocal())) {
				IResourceVariant remote = syncInfo.getRemote();
				if (remote != null && remote instanceof ISVNRemoteResource) {
					if (syncInfo.getRemoteResourceStatus() != null) {
						if (syncInfo.getRemoteResourceStatus().getTextStatus() == SVNStatusKind.DELETED) {
							// update contains deleted items
							useHEAD = true;
							break syncInfoLoop;
						}
					}
					SVNRevision rev = ((ISVNRemoteResource)remote).getLastChangedRevision();
					if (rev instanceof SVNRevision.Number) {
						long nbr = ((SVNRevision.Number)rev).getNumber();
						if (revision == null) revision = rev;
						else {
							long revisionNumber = ((SVNRevision.Number)revision).getNumber();
							if (nbr > revisionNumber) revision = rev;
						}
					}
				}
				break resourceLoop;
			}
		}
	}
	if (revision == null || useHEAD) revision = SVNRevision.HEAD;
	return revision;
}
 
Example 5
Source File: JhlConverter.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public static SVNStatusKind convertStatusKind(Status.Kind kind) {
	if (kind == null) {
		return null;
	}
    switch (kind) {
        case none :
            return SVNStatusKind.NONE;
        case normal :
            return SVNStatusKind.NORMAL;                
        case added :
            return SVNStatusKind.ADDED;
        case missing :
            return SVNStatusKind.MISSING;
        case incomplete :
            return SVNStatusKind.INCOMPLETE;
        case deleted :
            return SVNStatusKind.DELETED;
        case replaced :
            return SVNStatusKind.REPLACED;                                                
        case modified :
            return SVNStatusKind.MODIFIED;
        case merged :
            return SVNStatusKind.MERGED;                
        case conflicted :
            return SVNStatusKind.CONFLICTED;
        case obstructed :
            return SVNStatusKind.OBSTRUCTED;
        case ignored :
            return SVNStatusKind.IGNORED;  
        case external:
            return SVNStatusKind.EXTERNAL;
        case unversioned :
            return SVNStatusKind.UNVERSIONED;
        default : {
        	log.severe("unknown status kind :"+kind);
            return SVNStatusKind.NONE;
        }
    }
}
 
Example 6
Source File: GenerateDiffFileSynchronizeOperation.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
protected void run(SVNTeamProvider provider, SyncInfoSet set, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
		IResource[] resources = set.getResources();
		HashMap statusMap = new HashMap();
		unaddedList = new ArrayList();
		for (int i = 0; i < resources.length; i++) {
			ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resources[i]);
			SyncInfo syncInfo = set.getSyncInfo(resources[i]);
			SVNStatusKind statusKind = null;
			try {
				if (!svnResource.isManaged()) {
					statusKind = SVNStatusKind.UNVERSIONED;
				} else {
					switch (SyncInfo.getChange(syncInfo.getKind())) {
					case SyncInfo.ADDITION:
						statusKind = SVNStatusKind.ADDED;
						break;
					case SyncInfo.DELETION:
						statusKind = SVNStatusKind.DELETED;
						break;
					case SyncInfo.CONFLICTING:
						statusKind = SVNStatusKind.CONFLICTED;
						break;				
					default:
						statusKind = SVNStatusKind.MODIFIED;
						break;
					}
				}
				statusMap.put(resources[i], statusKind);				
				if (!svnResource.isManaged() && !svnResource.isIgnored())
					unaddedList.add(resources[i]);
			} catch (SVNException e) {
				SVNUIPlugin.log(IStatus.ERROR, e.getMessage(), e);
			}
		}
		ArrayList dedupedList = new ArrayList();
		Iterator iter = unaddedList.iterator();
		while (iter.hasNext()) {
			IResource resource = (IResource)iter.next();
			if (!isDupe(resource)) dedupedList.add(resource);
		}
		
		IResource[] unversionedResources = new IResource[dedupedList.size()];
		dedupedList.toArray(unversionedResources);
		GenerateDiffFileWizard wizard = new GenerateDiffFileWizard(new StructuredSelection(resources), unversionedResources, statusMap);
		wizard.setWindowTitle(Policy.bind("GenerateSVNDiff.title")); //$NON-NLS-1$
		wizard.setSelectedResources(selectedResources);
//		final WizardDialog dialog = new WizardDialog(getShell(), wizard);
//		dialog.setMinimumPageSize(350, 250);
		final WizardDialog dialog = new WizardDialogWithPersistedLocation(getShell(), wizard, "GenerateDiffFileWizard"); //$NON-NLS-1$
		dialog.setMinimumPageSize(350, 250);
		getShell().getDisplay().syncExec(new Runnable() {
			public void run() {
				dialog.open();	
			}
		});		
	}
 
Example 7
Source File: SVNStatusSyncInfo.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
protected int calculateKind() throws TeamException {
        SVNStatusKind localKind = baseStatusInfo.getStatusKind();
        SVNStatusKind repositoryKind = (remoteStatusInfo != null)
            								? remoteStatusInfo.getStatusKind() : SVNStatusKind.NORMAL;
        IResource local = getLocal();
        
        if (local.getParent() != null && !local.getParent().exists()) {
        	return SyncInfo.IN_SYNC;
        }
        
        // If resource is ignored through Eclipse project's resource filters property, IResource.exists() returns false,
        // even if the file/folder exists in the file system.  So we need to check for the existence in the file system
        // so that these items aren't incorrectly shown as outgoing deletions.

        if (!local.exists() && !(local.getLocation() == null || local.getLocation().toFile().exists())) {
        	if (isAddition(repositoryKind)) return SyncInfo.INCOMING | SyncInfo.ADDITION;
            if (localKind == SVNStatusKind.UNVERSIONED) return SyncInfo.IN_SYNC;
            if (isDeletion(repositoryKind)) return SyncInfo.IN_SYNC;
            if (!repositoryKind.equals(SVNStatusKind.ADDED)) {        	
            	if (localKind == SVNStatusKind.NONE) {
            		return SyncInfo.IN_SYNC;
            	}
            	
                if (isChange(repositoryKind)) return SyncInfo.CONFLICTING | SyncInfo.DELETION;
                return SyncInfo.OUTGOING | SyncInfo.DELETION;
            } else return SyncInfo.INCOMING | SyncInfo.ADDITION;
        }

        else if ( isDeletion(localKind))
        {
    		if (isNotModified(repositoryKind)) {
    			if (isOutOfDate())
    				return SyncInfo.CONFLICTING | SyncInfo.DELETION;
    			else
    				return SyncInfo.OUTGOING | SyncInfo.DELETION;
    		} else
    			return SyncInfo.CONFLICTING | SyncInfo.DELETION;
        }
        else if( isChange(localKind) ) {
            if( isChange( repositoryKind )
             || isAddition( repositoryKind ) 
             || isDeletion( repositoryKind ))
                return SyncInfo.CONFLICTING | SyncInfo.CHANGE;
            else {
            	if ((IResource.FOLDER == local.getType() || IResource.PROJECT == local.getType()) && isOutOfDate())
            		return SyncInfo.CONFLICTING | SyncInfo.CHANGE;
            	else
            		return SyncInfo.OUTGOING | SyncInfo.CHANGE;
            }
        }
        else if( isAddition( localKind ) ) {
            if( isAddition( repositoryKind ) )
                return SyncInfo.CONFLICTING | SyncInfo.ADDITION;
            return SyncInfo.OUTGOING | SyncInfo.ADDITION;
        }
        else if( isNotModified(localKind) ) {
            if( isNotModified( repositoryKind) ) {
            	if ((IResource.FOLDER == local.getType() || IResource.PROJECT == local.getType()) && isOutOfDate())
            		return SyncInfo.INCOMING | SyncInfo.CHANGE;
                return SyncInfo.IN_SYNC;
            }
            if ((localKind == SVNStatusKind.IGNORED) && (repositoryKind == SVNStatusKind.ADDED))
	                return SyncInfo.CONFLICTING | SyncInfo.ADDITION;
            if( repositoryKind == SVNStatusKind.DELETED )
                return SyncInfo.INCOMING | SyncInfo.DELETION;
            if( repositoryKind == SVNStatusKind.ADDED )
                return SyncInfo.INCOMING | SyncInfo.ADDITION;
            if( repositoryKind == SVNStatusKind.EXTERNAL)
                return SyncInfo.IN_SYNC;
//TODO Is this really necessary here ?
//            if (getComparator().compare(getBase(), getRemote())) 
//                return SyncInfo.IN_SYNC;
            return SyncInfo.INCOMING | SyncInfo.CHANGE;
        }
        else if( repositoryKind == SVNStatusKind.EXTERNAL ) {
            if (localKind == SVNStatusKind.EXTERNAL)
            	return SyncInfo.IN_SYNC;
        }
        else if ((localKind == SVNStatusKind.EXTERNAL) && (remoteStatusInfo == null))
        {
        	return SyncInfo.IN_SYNC;
        }
        
        return super.calculateKind();
    }
 
Example 8
Source File: SVNStatusSyncInfo.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
private boolean isDeletion(SVNStatusKind kind) {
    return kind == SVNStatusKind.DELETED
|| kind == SVNStatusKind.MISSING;
}