Search in sources :

Example 1 with ISVNLock

use of org.tigris.subversion.svnclientadapter.ISVNLock in project subclipse by subclipse.

the class RemoteFolder method getMembers.

/**
 * Get the members of this folder at the same revision than this resource
 *
 * @param monitor a progress monitor
 * @return ISVNRemoteResource[] an array of child remoteResources
 */
protected ISVNRemoteResource[] getMembers(IProgressMonitor monitor) throws SVNException {
    final IProgressMonitor progress = Policy.monitorFor(monitor);
    // $NON-NLS-1$
    progress.beginTask(Policy.bind("RemoteFolder.getMembers"), 100);
    // Try to hit the cache first.
    if (children != null) {
        progress.done();
        return children;
    }
    ISVNClientAdapter client = null;
    try {
        client = getRepository().getSVNClient();
        ISVNDirEntryWithLock[] list = client.getListWithLocks(url, getRevision(), SVNRevision.HEAD, false);
        List<RemoteResource> result = new ArrayList<RemoteResource>(list.length);
        // directories first
        for (ISVNDirEntryWithLock entryWithLock : list) {
            ISVNDirEntry entry = entryWithLock.getDirEntry();
            if (entry.getNodeKind() == SVNNodeKind.DIR) {
                result.add(new RemoteFolder(this, getRepository(), url.appendPath(entry.getPath()), getRevision(), entry.getLastChangedRevision(), entry.getLastChangedDate(), entry.getLastCommitAuthor()));
            }
        }
        // files then
        for (ISVNDirEntryWithLock entryWithLock : list) {
            ISVNDirEntry entry = entryWithLock.getDirEntry();
            ISVNLock lock = entryWithLock.getLock();
            if (entry.getNodeKind() == SVNNodeKind.FILE) {
                RemoteFile remoteFile = new RemoteFile(this, getRepository(), url.appendPath(entry.getPath()), getRevision(), entry.getLastChangedRevision(), entry.getLastChangedDate(), entry.getLastCommitAuthor());
                remoteFile.setPegRevision(getRevision());
                remoteFile.setLock(lock);
                result.add(remoteFile);
            }
        }
        // Save it to the cache
        children = (ISVNRemoteResource[]) result.toArray(new ISVNRemoteResource[result.size()]);
        return children;
    } catch (SVNClientException e) {
        throw new SVNException(new SVNStatus(IStatus.ERROR, SVNStatus.DOES_NOT_EXIST, Policy.bind("RemoteFolder.doesNotExist", // $NON-NLS-1$
        getRepositoryRelativePath())));
    } finally {
        getRepository().returnSVNClient(client);
        progress.done();
    }
}
Also used : ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) ISVNRemoteFolder(org.tigris.subversion.subclipse.core.ISVNRemoteFolder) ISVNLock(org.tigris.subversion.svnclientadapter.ISVNLock) ArrayList(java.util.ArrayList) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) SVNException(org.tigris.subversion.subclipse.core.SVNException) SVNStatus(org.tigris.subversion.subclipse.core.SVNStatus) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) SVNClientException(org.tigris.subversion.svnclientadapter.SVNClientException) ISVNDirEntryWithLock(org.tigris.subversion.svnclientadapter.ISVNDirEntryWithLock) ISVNDirEntry(org.tigris.subversion.svnclientadapter.ISVNDirEntry) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Aggregations

ArrayList (java.util.ArrayList)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 ISVNRemoteFolder (org.tigris.subversion.subclipse.core.ISVNRemoteFolder)1 ISVNRemoteResource (org.tigris.subversion.subclipse.core.ISVNRemoteResource)1 SVNException (org.tigris.subversion.subclipse.core.SVNException)1 SVNStatus (org.tigris.subversion.subclipse.core.SVNStatus)1 ISVNClientAdapter (org.tigris.subversion.svnclientadapter.ISVNClientAdapter)1 ISVNDirEntry (org.tigris.subversion.svnclientadapter.ISVNDirEntry)1 ISVNDirEntryWithLock (org.tigris.subversion.svnclientadapter.ISVNDirEntryWithLock)1 ISVNLock (org.tigris.subversion.svnclientadapter.ISVNLock)1 SVNClientException (org.tigris.subversion.svnclientadapter.SVNClientException)1