Java Code Examples for org.tigris.subversion.svnclientadapter.SVNStatusKind#equals()

The following examples show how to use org.tigris.subversion.svnclientadapter.SVNStatusKind#equals() . 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: ResourceSelectionTree.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public int getKind() {
	int kind = IDiff.NO_CHANGE;
	if (syncInfoSet != null) {
		SyncInfo syncInfo = syncInfoSet.getSyncInfo(resource);
		if (syncInfo != null) {
			int change = SyncInfo.getChange(syncInfo.getKind());
			if (change == SyncInfo.CONFLICTING) kind = IThreeWayDiff.CONFLICTING;
			else if (change == SyncInfo.CHANGE) kind = IDiff.CHANGE;
			else if (change == SyncInfo.ADDITION) kind = IDiff.ADD;
			else if (change == SyncInfo.DELETION) kind = IDiff.REMOVE;
		}
	} else {
		SVNStatusKind statusKind = (SVNStatusKind)statusMap.get(resource);
		if (statusKind == null) kind = IDiff.NO_CHANGE;
		else if (statusKind.equals(SVNStatusKind.CONFLICTED)) kind = IThreeWayDiff.CONFLICTING;
		else if (statusKind.equals(SVNStatusKind.MODIFIED)) kind = IDiff.CHANGE;
		else if (statusKind.equals(SVNStatusKind.ADDED)) kind = IDiff.ADD;
		else if (statusKind.equals(SVNStatusKind.DELETED)) kind = IDiff.REMOVE;
	}
	if (resource instanceof IContainer) return IDiff.REMOVE;
	return kind;
}
 
Example 2
Source File: SVNLocalCompareSummaryInput.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private SVNDiffSummary[] getDiffSummary(RemoteResourceStatus[] statuses, ISVNLocalResource resource) {
	List diffSummaryList = new ArrayList();
	int rootPathLength = resource.getResource().getLocation().toString().length() + 1;
	for (int i = 0; i < statuses.length; i++) {
		if (statuses[i].getFile() != null && !statuses[i].getNodeKind().equals(SVNNodeKind.DIR)) {
			SVNStatusKind textStatus = statuses[i].getTextStatus();
			boolean propertyChanges = !statuses[i].getPropStatus().equals(SVNStatusKind.NORMAL) && !statuses[i].getPropStatus().equals(SVNStatusKind.NONE);
			boolean localChanges = false;
			if (textStatus.equals(SVNStatusKind.NONE) && propertyChanges && statuses[i].getNodeKind().equals(SVNNodeKind.FILE)) {
				IFile file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(statuses[i].getPath()));
				if (file != null) {
					ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(file);
					try {
						LocalResourceStatus localStatus = svnResource.getStatus();
						if (localStatus != null) {
							localChanges = localStatus.isAdded() || localStatus.isDirty();
						}
					} catch (SVNException e) {}
				}
			}
			if (!textStatus.equals(SVNStatusKind.NONE) || !propertyChanges || localChanges) {
				SVNDiffKind diffKind = null;
				if (statuses[i].getTextStatus().equals(SVNStatusKind.ADDED)) diffKind = SVNDiffKind.ADDED;
				else if (statuses[i].getTextStatus().equals(SVNStatusKind.DELETED)) diffKind = SVNDiffKind.DELETED;
				else diffKind = SVNDiffKind.MODIFIED;
				SVNDiffSummary diffSummary = new SVNDiffSummary(statuses[i].getPath().substring(rootPathLength).replaceAll("\\\\", "/"), diffKind, propertyChanges, statuses[i].getNodeKind().toInt()); //$NON-NLS-1$ //$NON-NLS-2$
				diffSummaryList.add(diffSummary);
			}
		}
	}
	SVNDiffSummary[] diffSummaries = new SVNDiffSummary[diffSummaryList.size()];
	diffSummaryList.toArray(diffSummaries);
	return diffSummaries;
}
 
Example 3
Source File: LocalResourceStatus.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * text is considered dirty if text status has status added, deleted,
 * replaced, modified, merged or conflicted.
 * 
 * @return true if the resource text is dirty
 */
public boolean isTextDirty() {
    SVNStatusKind theTextStatus = getTextStatus();

    return ((theTextStatus.equals(SVNStatusKind.ADDED))
            || (theTextStatus.equals(SVNStatusKind.DELETED))
            || (theTextStatus.equals(SVNStatusKind.REPLACED))
            || (theTextStatus.equals(SVNStatusKind.MODIFIED))
            || (theTextStatus.equals(SVNStatusKind.MERGED)) || (theTextStatus
            .equals(SVNStatusKind.CONFLICTED)));
}
 
Example 4
Source File: CommandlineClient.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private boolean isManaged(SVNStatusKind s) {
    return !(s.equals(SVNStatusKind.UNVERSIONED) ||
             s.equals(SVNStatusKind.NONE) ||
             s.equals(SVNStatusKind.IGNORED) ||
             s.equals(SVNStatusKind.EXTERNAL));
}
 
Example 5
Source File: LocalResourceStatus.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
/**
 * prop is considered dirty if prop status is either conflicted or modified
 * 
 * @return true if the resource property is dirty
 */
public boolean isPropDirty() {
    SVNStatusKind thePropStatus = getPropStatus();
    return thePropStatus.equals(SVNStatusKind.CONFLICTED)
            || thePropStatus.equals(SVNStatusKind.MODIFIED);
}
 
Example 6
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 7
Source File: SVNStatusUtils.java    From APICloud-Studio with GNU General Public License v3.0 2 votes vote down vote up
/**
 * @param textStatus The status information to examine
 * (non-<code>null</code>).
 * @return Whether <code>textStatus</code> denotes a versioned
 * resource.
 */
public static boolean isManaged(SVNStatusKind textStatus) {
    return (!textStatus.equals(SVNStatusKind.UNVERSIONED)
            && !textStatus.equals(SVNStatusKind.NONE)
            && !textStatus.equals(SVNStatusKind.IGNORED));
}
 
Example 8
Source File: SVNStatusUtils.java    From APICloud-Studio with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Returns if the resource has a remote counter-part
 * @param status
 * 
 * @return has version in repository
 */
public static boolean hasRemote(ISVNStatus status) {
	SVNStatusKind textStatus = status.getTextStatus();
    return ((isManaged(textStatus)) && (!textStatus.equals(SVNStatusKind.ADDED) || status.isCopied()));
}