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();
}
}
Aggregations