01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: *
17: */
18:
19: package org.apache.tools.ant.taskdefs.optional.vss;
20:
21: import org.apache.tools.ant.BuildException;
22: import org.apache.tools.ant.types.Commandline;
23:
24: /**
25: * Performs CP (Change Project) commands to Microsoft Visual SourceSafe.
26: * <p>This task is typically used before a VssAdd in order to set the target project</p>
27: *
28: * @ant.task name="vsscp" category="scm"
29: */
30: public class MSVSSCP extends MSVSS {
31:
32: /**
33: * Builds a command line to execute ss.
34: * @return The constructed commandline.
35: */
36: protected Commandline buildCmdLine() {
37: Commandline commandLine = new Commandline();
38:
39: // first off, make sure that we've got a command and a vssdir ...
40: if (getVsspath() == null) {
41: String msg = "vsspath attribute must be set!";
42: throw new BuildException(msg, getLocation());
43: }
44:
45: // build the command line from what we got the format is
46: // ss CP VSS items [-H] [-I-] [-Y] [-?]
47: // as specified in the SS.EXE help
48: commandLine.setExecutable(getSSCommand());
49: commandLine.createArgument().setValue(COMMAND_CP);
50:
51: // VSS items
52: commandLine.createArgument().setValue(getVsspath());
53: // -I- or -I-Y or -I-N
54: commandLine.createArgument().setValue(getAutoresponse());
55: // -Y
56: commandLine.createArgument().setValue(getLogin());
57:
58: return commandLine;
59: }
60:
61: /**
62: * Autoresponce behaviour. Valid options are Y and N.
63: *
64: * @param response The auto response value.
65: */
66: public void setAutoresponse(String response) {
67: super.setInternalAutoResponse(response);
68: }
69: }
|