boolean isRevProp = getCommandLine().hasArgument(SVNArgument.REV_PROP);
File reposRoot = new File(getCommandLine().getPathAt(0));
String propertyName = getCommandLine().getPathCount() < 2 ? null : getCommandLine().getPathAt(1);
SVNRevision revision = SVNRevision.HEAD;
SVNLookClient lookClient = getClientManager().getLookClient();
if (getCommandLine().hasArgument(SVNArgument.TRANSACTION)) {
String transactionName = (String) getCommandLine().getArgumentValue(SVNArgument.TRANSACTION);
String path = null;
String value = null;
if (isRevProp) {
value = lookClient.doGetRevisionProperty(reposRoot, propertyName, transactionName);
} else {
path = getCommandLine().getPathCount() < 3 ? null : SVNPathUtil.canonicalizeAbsPath(getCommandLine().getPathAt(2));
value = lookClient.doGetProperty(reposRoot, propertyName, path, transactionName);
}
if (value == null) {
if (path == null) {
SVNCommand.println(err, "Property '" + propertyName + "' not found on transaction '" + transactionName + "'");
System.exit(1);
} else {
SVNCommand.println(err, "Property '" + propertyName + "' not found on path '" + path + "' in transaction '" + transactionName + "'");
System.exit(1);
}
}
SVNCommand.print(out, value);
return;
} else if (getCommandLine().hasArgument(SVNArgument.REVISION)) {
revision = SVNRevision.parse((String) getCommandLine().getArgumentValue(SVNArgument.REVISION));
}
String path = null;
String value = null;
if (isRevProp) {
value = lookClient.doGetRevisionProperty(reposRoot, propertyName, revision);
} else {
path = getCommandLine().getPathCount() < 3 ? null : SVNPathUtil.canonicalizeAbsPath(getCommandLine().getPathAt(2));
value = lookClient.doGetProperty(reposRoot, propertyName, path, revision);
}
if (value == null) {
long revNum = -1;
if (SVNRevision.isValidRevisionNumber(revision.getNumber())) {
revNum = revision.getNumber();