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

The following examples show how to use org.tigris.subversion.svnclientadapter.ISVNStatus#getPropStatus() . 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: CommandlineClient.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void notifyChangedStatus(File file, boolean rec, ISVNStatus[] oldStatuses) throws SVNClientException {
    Map<File, ISVNStatus> oldStatusMap = new HashMap<File, ISVNStatus>();
    for (ISVNStatus s : oldStatuses) {
        oldStatusMap.put(s.getFile(), s);
    }
    ISVNStatus[] newStatuses = getStatus(file, rec, true);
    for (ISVNStatus newStatus : newStatuses) {
        ISVNStatus oldStatus = oldStatusMap.get(newStatus.getFile());
        if( (oldStatus == null && newStatus != null) ||
             oldStatus.getTextStatus() != newStatus.getTextStatus() ||
             oldStatus.getPropStatus() != newStatus.getPropStatus())
        {
            notificationHandler.notifyListenersOfChange(newStatus.getPath()); /// onNotify(cmd.getAbsoluteFile(s.getFile().getAbsolutePath()), null);
        }
   }
}
 
Example 2
Source File: ResolveConflictsAction.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private static Map<File, ISVNStatus> getPropertyConflicts (File[] files) {
    Map<File, ISVNStatus> propertyConflicts = new HashMap<File, ISVNStatus>(files.length);
    if (files.length > 0) {
        try {
            SvnClient client = Subversion.getInstance().getClient(false);
            FileStatusCache cache = Subversion.getInstance().getStatusCache();
            for (File file : files) {
                if ((cache.getStatus(file).getStatus() & FileInformation.STATUS_VERSIONED_CONFLICT_CONTENT) != 0) {
                    ISVNStatus status = SvnUtils.getSingleStatus(client, file);
                    if (status.getPropStatus() == SVNStatusKind.CONFLICTED) {
                        propertyConflicts.put(file, status);
                    }
                }
            }
        } catch (SVNClientException ex) {
            Subversion.LOG.log(Level.INFO, null, ex);
        }
    }
    return propertyConflicts;
}
 
Example 3
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 4
Source File: FileStatusCache.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/**
 * Examines a file or folder that has an associated CVS entry. 
 * 
 * @param file file/folder to examine
 * @param status status of the file/folder as reported by the CVS server 
 * @return FileInformation file/folder status bean
 */ 
private FileInformation createVersionedFileInformation(File file, ISVNStatus status, RepositoryStatus repositoryStatus) {

    SVNStatusKind kind = status.getTextStatus();
    SVNStatusKind pkind = status.getPropStatus();

    int remoteStatus = 0;
    if (repositoryStatus != REPOSITORY_STATUS_UNKNOWN) {
        if (repositoryStatus.getStatus().getRepositoryTextStatus() == SVNStatusKind.MODIFIED
        || repositoryStatus.getStatus().getRepositoryPropStatus() == SVNStatusKind.MODIFIED) {
            remoteStatus = FileInformation.STATUS_VERSIONED_MODIFIEDINREPOSITORY;
        } else if (repositoryStatus.getStatus().getRepositoryTextStatus() == SVNStatusKind.DELETED
        /*|| repositoryStatus.getRepositoryPropStatus() == SVNStatusKind.DELETED*/) {
            remoteStatus = FileInformation.STATUS_VERSIONED_REMOVEDINREPOSITORY;
        } else if (repositoryStatus.getStatus().getRepositoryTextStatus() == SVNStatusKind.ADDED
                    || repositoryStatus.getStatus().getRepositoryTextStatus() == SVNStatusKind.REPLACED) {
            // solved in createMissingfileInformation
        } else if ( (repositoryStatus.getStatus().getRepositoryTextStatus() == null &&
                     repositoryStatus.getStatus().getRepositoryPropStatus() == null)
                    ||
                    (repositoryStatus.getStatus().getRepositoryTextStatus() == SVNStatusKind.NONE &&
                     repositoryStatus.getStatus().getRepositoryPropStatus() == SVNStatusKind.NONE))
        {
            // no remote change at all
        } else {
            // so far above were observed....
            Subversion.LOG.log(Level.WARNING,"SVN.FSC: unhandled repository status: {0}" + "\n" +   // NOI18N
                                   "\ttext: " + "{1}" + "\n" +             // NOI18N
                                   "\tprop: " + "{2}", new Object[] { file.getAbsolutePath(), repositoryStatus.getStatus().getRepositoryTextStatus(), //NOI18N
                                       repositoryStatus.getStatus().getRepositoryPropStatus() });
        }
        if (repositoryStatus.getLock() != null) {
            remoteStatus |= FileInformation.STATUS_LOCKED_REMOTELY;
        }
    }
    
    if (status. getLockOwner() != null) {
        remoteStatus = FileInformation.STATUS_LOCKED | remoteStatus;
    }
    
    int propertyStatus = 0;
    if (SVNStatusKind.NONE.equals(pkind)) {
        // no influence
    } else if (SVNStatusKind.NORMAL.equals(pkind)) {
        // no influence
    } else if (SVNStatusKind.MODIFIED.equals(pkind)) {
        propertyStatus = FileInformation.STATUS_VERSIONED_MODIFIEDLOCALLY_PROPERTY;
    } else if (SVNStatusKind.CONFLICTED.equals(pkind)) {
        return new FileInformation(FileInformation.STATUS_VERSIONED_CONFLICT_CONTENT | remoteStatus, status);
    } else {
        throw new IllegalArgumentException("Unknown prop status: " + status.getPropStatus()); // NOI18N
    }

    int additionalStatus = remoteStatus | propertyStatus;
    if (status.hasTreeConflict()) {
        return new FileInformation(FileInformation.STATUS_VERSIONED_CONFLICT_TREE | additionalStatus, status);
    } else if (SVNStatusKind.NONE.equals(kind)) {
        return FILE_INFORMATION_UNKNOWN;
    } else if (SVNStatusKind.NORMAL.equals(kind)) {
        int finalStatus = FileInformation.STATUS_VERSIONED_UPTODATE | remoteStatus;
        if (propertyStatus != 0) {
            finalStatus = additionalStatus;
        }
        return new FileInformation(finalStatus, status);
    } else if (SVNStatusKind.MODIFIED.equals(kind)) {
        return new FileInformation(FileInformation.STATUS_VERSIONED_MODIFIEDLOCALLY_CONTENT | additionalStatus, status);
    } else if (SVNStatusKind.ADDED.equals(kind)) {
        return new FileInformation(FileInformation.STATUS_VERSIONED_ADDEDLOCALLY | additionalStatus, status);
    } else if (SVNStatusKind.DELETED.equals(kind)) {                    
        return new FileInformation(FileInformation.STATUS_VERSIONED_REMOVEDLOCALLY | additionalStatus, status);
    } else if (SVNStatusKind.UNVERSIONED.equals(kind)) {            
        return new FileInformation(FileInformation.STATUS_NOTVERSIONED_NEWLOCALLY | additionalStatus, status);
    } else if (SVNStatusKind.MISSING.equals(kind)) {            
        return new FileInformation(FileInformation.STATUS_VERSIONED_DELETEDLOCALLY | additionalStatus, status);
    } else if (SVNStatusKind.REPLACED.equals(kind)) {                      
        // this status or better to use this simplyfication?
        return new FileInformation(FileInformation.STATUS_VERSIONED_ADDEDLOCALLY | additionalStatus, status);
    } else if (SVNStatusKind.MERGED.equals(kind)) {            
        return new FileInformation(FileInformation.STATUS_VERSIONED_MERGE | additionalStatus, status);
    } else if (SVNStatusKind.CONFLICTED.equals(kind)) {            
        return new FileInformation(FileInformation.STATUS_VERSIONED_CONFLICT_CONTENT | additionalStatus, status);
    } else if (SVNStatusKind.OBSTRUCTED.equals(kind)) {            
        return new FileInformation(FileInformation.STATUS_VERSIONED_CONFLICT_CONTENT | additionalStatus, status);
    } else if (SVNStatusKind.IGNORED.equals(kind)) {            
        return new FileInformation(FileInformation.STATUS_NOTVERSIONED_EXCLUDED | remoteStatus, status);
    } else if (SVNStatusKind.INCOMPLETE.equals(kind)) {            
        return new FileInformation(FileInformation.STATUS_VERSIONED_CONFLICT_CONTENT | additionalStatus, status);
    } else if (SVNStatusKind.EXTERNAL.equals(kind)) {            
        return new FileInformation(FileInformation.STATUS_VERSIONED_UPTODATE | remoteStatus, status);
    } else {        
        throw new IllegalArgumentException("Unknown text status: " + status.getTextStatus()); // NOI18N
    }
}