/*
* ====================================================================
* Copyright (c) 2004-2012 TMate Software Ltd. All rights reserved.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://svnkit.com/license.html.
* If newer versions of this license are posted there, you may use a
* newer version instead, at your option.
* ====================================================================
*/
package org.tmatesoft.svn.cli.svn;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.internal.wc.SVNPath;
import org.tmatesoft.svn.core.wc.SVNWCClient;
/**
* @version 1.3
* @author TMate Software Ltd.
*/
public class SVNCleanupCommand extends SVNCommand {
public SVNCleanupCommand() {
super("cleanup", null);
}
protected Collection createSupportedOptions() {
Collection options = new LinkedList();
options.add(SVNOption.DIFF3_CMD);
return options;
}
public void run() throws SVNException {
List targets = getSVNEnvironment().combineTargets(getSVNEnvironment().getTargets(), true);
if (targets.isEmpty()) {
targets.add("");
}
SVNWCClient client = getSVNEnvironment().getClientManager().getWCClient();
for (Iterator ts = targets.iterator(); ts.hasNext();) {
String targetName = (String) ts.next();
SVNPath target = new SVNPath(targetName);
if (target.isFile()) {
client.doCleanup(target.getFile());
}
}
}
}