myIsVerbose = getCommandLine().hasArgument(SVNArgument.VERBOSE);
myPrintStream = out;
boolean isXml = getCommandLine().hasArgument(SVNArgument.XML);
SVNXMLSerializer serializer = isXml ? new SVNXMLSerializer(myPrintStream) : null;
SVNXMLDirEntryHandler handler = isXml ? new SVNXMLDirEntryHandler(serializer) : null;
SVNRevision revision = parseRevision(getCommandLine());
SVNLogClient logClient = getClientManager().getLogClient();
if (!getCommandLine().hasURLs() && !getCommandLine().hasPaths()) {
getCommandLine().setPathAt(0, "");
}
if (handler != null) {
if (!getCommandLine().hasArgument(SVNArgument.INCREMENTAL)) {
handler.startDocument();
}
}
for(int i = 0; i < getCommandLine().getURLCount(); i++) {
String url = getCommandLine().getURL(i);
if (handler != null) {
handler.startTarget(url);
}
logClient.doList(SVNURL.parseURIEncoded(url), getCommandLine().getPegRevision(i), revision == null ? SVNRevision.UNDEFINED : revision, myIsVerbose || isXml, recursive, isXml ? handler : (ISVNDirEntryHandler) this);
if (handler != null) {
handler.endTarget();
}
}
for(int i = 0; i < getCommandLine().getPathCount(); i++) {
File path = new File(getCommandLine().getPathAt(i)).getAbsoluteFile();
if (handler != null) {
handler.startTarget(path.getAbsolutePath().replace(File.separatorChar, '/'));
}
logClient.doList(path, getCommandLine().getPathPegRevision(i), revision == null || !revision.isValid() ? SVNRevision.BASE : revision, myIsVerbose || isXml, recursive, isXml ? handler : (ISVNDirEntryHandler) this);
if (handler != null) {
handler.endTarget();
}
}
if (handler != null) {
if (!getCommandLine().hasArgument(SVNArgument.INCREMENTAL)) {
handler.endDocument();
}
try {
serializer.flush();
} catch (IOException e) {
}