} else if (getSVNEnvironment().getStartRevision() != SVNRevision.UNDEFINED) {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR,
"Cannot specify revision for deleting versioned property ''{0}''", propertyName);
SVNErrorManager.error(err, SVNLogType.CLIENT);
} else {
SVNDepth depth = getSVNEnvironment().getDepth();
if (depth == SVNDepth.UNKNOWN) {
depth = SVNDepth.EMPTY;
}
Collection changeLists = getSVNEnvironment().getChangelistsCollection();
SVNWCClient client = getSVNEnvironment().getClientManager().getWCClient();
final boolean[] deletedNonExistent = new boolean[] {false};
client.setEventHandler(new ISVNEventHandler() {
public void handleEvent(SVNEvent event, double progress) throws SVNException {
if (event.getAction() == SVNEventAction.PROPERTY_DELETE_NONEXISTENT) {
deletedNonExistent[0] = true;
}
}
public void checkCancelled() throws SVNCancelException {
getSVNEnvironment().checkCancelled();
}
});
for (Iterator ts = targets.iterator(); ts.hasNext();) {
String targetName = (String) ts.next();
SVNPath target = new SVNPath(targetName);
if (target.isFile()) {
boolean success = true;
try {
if (target.isFile()){
client.doSetProperty(target.getFile(), propertyName, null,
getSVNEnvironment().isForce(), depth, this, changeLists);
} else {
client.setCommitHandler(getSVNEnvironment());
client.doSetProperty(target.getURL(), propertyName, null, SVNRevision.HEAD, getSVNEnvironment().getMessage(),
getSVNEnvironment().getRevisionProperties(), getSVNEnvironment().isForce(), this);
}
if (deletedNonExistent[0]) {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_PROPERTY_NAME, "Attempting to delete nonexistent property ''{0}''", propertyName);
SVNErrorManager.error(err, SVNLogType.CLIENT);
}
} catch (SVNException e) {
success = getSVNEnvironment().handleWarning(e.getErrorMessage(),
new SVNErrorCode[] {SVNErrorCode.UNVERSIONED_RESOURCE, SVNErrorCode.ENTRY_NOT_FOUND},
getSVNEnvironment().isQuiet());
}
clearCollectedProperties();
if (success && !getSVNEnvironment().isQuiet()) {
if (success) {
String path = SVNCommandUtil.getLocalPath(targetName);
String message = depth.isRecursive() ?
"property ''{0}'' deleted (recursively) from ''{1}''." :
"property ''{0}'' deleted from ''{1}''.";
message = MessageFormat.format(message, new Object[] {propertyName, path});
getSVNEnvironment().getOut().println(message);
}