}
private void doList(SVNRepository repos, long rev, final ISVNDirEntryHandler handler, boolean fetchLocks, SVNDepth depth, int entryFields) throws SVNException {
SVNURL url = repos.getLocation();
SVNURL reposRoot = repos.getRepositoryRoot(false);
SVNDirEntry entry = null;
SVNException error = null;
try {
entry = repos.info("", rev);
} catch (SVNException svne) {
if (svne.getErrorMessage().getErrorCode() == SVNErrorCode.RA_NOT_IMPLEMENTED) {
error = svne;
} else {
throw svne;
}
}
if (error != null) {
SVNNodeKind kind = repos.checkPath("", rev);
if (kind != SVNNodeKind.NONE) {
if (!url.equals(reposRoot)) {
String name = SVNPathUtil.tail(repos.getLocation().getPath());
repos.setLocation(repos.getLocation().removePathTail(), false);
Collection dirEntries = repos.getDir("", rev, null, entryFields, (Collection) null);
repos.setLocation(url, false);
for (Iterator ents = dirEntries.iterator(); ents.hasNext();) {
SVNDirEntry dirEntry = (SVNDirEntry) ents.next();
if (name.equals(dirEntry.getName())) {
entry = dirEntry;
break;
}
}
if (entry != null) {
entry.setRelativePath(kind == SVNNodeKind.FILE ? name : "");
}
} else {
SVNProperties props = new SVNProperties();
repos.getDir("", rev, props, entryFields, (Collection) null);
SVNProperties revProps = repos.getRevisionProperties(rev, null);
String author = revProps.getStringValue(SVNRevisionProperty.AUTHOR);
String dateStr = revProps.getStringValue(SVNRevisionProperty.DATE);
Date datestamp = null;
if (dateStr != null) {
datestamp = SVNDate.parseDateString(dateStr);
}
entry = new SVNDirEntry(url, reposRoot, "", kind, 0, !props.isEmpty(), rev, datestamp, author);
entry.setRelativePath("");
}
}
} else if (entry != null) {
entry.setRelativePath(entry.getKind() == SVNNodeKind.DIR ? "" : entry.getName());
}
if (entry == null) {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_NOT_FOUND, "URL ''{0}'' non-existent in that revision", url);
SVNErrorManager.error(err, SVNLogType.WC);
}
final Map locksMap = new SVNHashMap();
if (fetchLocks) {
SVNLock[] locks = new SVNLock[0];
try {
locks = repos.getLocks("");
} catch (SVNException e) {
if (!(e.getErrorMessage() != null && e.getErrorMessage().getErrorCode() == SVNErrorCode.RA_NOT_IMPLEMENTED)) {
throw e;
}
}
if (locks != null && locks.length > 0) {
SVNURL root = repos.getRepositoryRoot(true);
for (int i = 0; i < locks.length; i++) {
String repositoryPath = locks[i].getPath();
locksMap.put(root.appendPath(repositoryPath, false), locks[i]);
}
}
}
ISVNDirEntryHandler nestedHandler = new ISVNDirEntryHandler() {
public void handleDirEntry(SVNDirEntry dirEntry) throws SVNException {
dirEntry.setLock((SVNLock) locksMap.get(dirEntry.getURL()));
handler.handleDirEntry(dirEntry);
}
};
nestedHandler.handleDirEntry(entry);