01: /*
02: * ====================================================================
03: * Copyright (c) 2004-2008 TMate Software Ltd. All rights reserved.
04: *
05: * This software is licensed as described in the file COPYING, which
06: * you should have received as part of this distribution. The terms
07: * are also available at http://svnkit.com/license.html
08: * If newer versions of this license are posted there, you may use a
09: * newer version instead, at your option.
10: * ====================================================================
11: */
12:
13: package org.tmatesoft.svn.cli.command;
14:
15: import java.io.File;
16: import java.io.InputStream;
17: import java.io.PrintStream;
18:
19: import org.tmatesoft.svn.cli.SVNArgument;
20: import org.tmatesoft.svn.cli.SVNCommand;
21: import org.tmatesoft.svn.core.SVNException;
22: import org.tmatesoft.svn.core.wc.SVNWCClient;
23:
24: /**
25: * @version 1.1.1
26: * @author TMate Software Ltd.
27: */
28: public class SVNAddCommand extends SVNCommand {
29:
30: public final void run(final PrintStream out, PrintStream err)
31: throws SVNException {
32: final boolean recursive = !getCommandLine().hasArgument(
33: SVNArgument.NON_RECURSIVE);
34: boolean force = getCommandLine().hasArgument(SVNArgument.FORCE);
35: boolean disableAutoProps = getCommandLine().hasArgument(
36: SVNArgument.NO_AUTO_PROPS);
37: boolean enableAutoProps = getCommandLine().hasArgument(
38: SVNArgument.AUTO_PROPS);
39:
40: getClientManager().setEventHandler(
41: new SVNCommandEventProcessor(out, err, false));
42: SVNWCClient wcClient = getClientManager().getWCClient();
43:
44: if (disableAutoProps) {
45: wcClient.getOptions().setUseAutoProperties(false);
46: }
47: if (enableAutoProps) {
48: wcClient.getOptions().setUseAutoProperties(true);
49: }
50: boolean noIgnore = getCommandLine().hasArgument(
51: SVNArgument.NO_IGNORE);
52: for (int i = 0; i < getCommandLine().getPathCount(); i++) {
53: final String absolutePath = getCommandLine().getPathAt(i);
54: matchTabsInPath(absolutePath, err);
55: wcClient.doAdd(new File(absolutePath), force, false, false,
56: recursive, noIgnore);
57: }
58: }
59:
60: public void run(InputStream in, PrintStream out, PrintStream err)
61: throws SVNException {
62: run(out, err);
63: }
64:
65: }
|