source: other-projects/trunk/gs3-release-maker/apache-ant-1.6.5/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSADD.java@ 14627

Last change on this file since 14627 was 14627, checked in by oranfry, 17 years ago

initial import of the gs3-release-maker

File size: 3.8 KB
Line 
1/*
2 * Copyright 2002-2004 The Apache Software Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17
18package org.apache.tools.ant.taskdefs.optional.vss;
19
20import org.apache.tools.ant.BuildException;
21import org.apache.tools.ant.types.Commandline;
22import org.apache.tools.ant.types.Path;
23
24/**
25 * Performs Add commands to Microsoft Visual SourceSafe.
26 *
27 *
28 * @ant.task name="vssadd" category="scm"
29 */
30public class MSVSSADD extends MSVSS {
31
32 private String localPath = null;
33
34 /**
35 * Builds a command line to execute ss.
36 * @return The constructed commandline.
37 */
38 protected Commandline buildCmdLine() {
39 Commandline commandLine = new Commandline();
40
41 // first off, make sure that we've got a command and a localPath ...
42 if (getLocalpath() == null) {
43 String msg = "localPath attribute must be set!";
44 throw new BuildException(msg, getLocation());
45 }
46
47 // build the command line from what we got the format is
48 // ss Add VSS items [-B] [-C] [-D-] [-H] [-I-] [-K] [-N] [-O] [-R] [-W] [-Y] [-?]
49 // as specified in the SS.EXE help
50 commandLine.setExecutable(getSSCommand());
51 commandLine.createArgument().setValue(COMMAND_ADD);
52
53 // VSS items
54 commandLine.createArgument().setValue(getLocalpath());
55 // -I- or -I-Y or -I-N
56 commandLine.createArgument().setValue(getAutoresponse());
57 // -R
58 commandLine.createArgument().setValue(getRecursive());
59 // -W
60 commandLine.createArgument().setValue(getWritable());
61 // -Y
62 commandLine.createArgument().setValue(getLogin());
63 // -C
64 commandLine.createArgument().setValue(getComment());
65
66 return commandLine;
67 }
68
69 /**
70 * Returns the local path without the flag.; required
71 * @todo See why this returns the local path without the flag.
72 * @return The local path value.
73 */
74 protected String getLocalpath() {
75 return localPath;
76 }
77
78 /**
79 * Add files recursively. Defaults to false.
80 *
81 * @param recursive The boolean value for recursive.
82 */
83 public void setRecursive(boolean recursive) {
84 super.setInternalRecursive(recursive);
85 }
86
87 /**
88 * Unset the READ-ONLY flag on local copies of files added to VSS. Defaults to false.
89 *
90 * @param writable The boolean value for writable.
91 */
92 public final void setWritable(boolean writable) {
93 super.setInternalWritable(writable);
94 }
95
96 /**
97 * Autoresponce behaviour. Valid options are Y and N.
98 *
99 * @param response The auto response value.
100 */
101 public void setAutoresponse(String response) {
102 super.setInternalAutoResponse(response);
103 }
104
105 /**
106 * Comment to apply to files added to SourceSafe.
107 *
108 * @param comment The comment to apply in SourceSafe
109 */
110 public void setComment(String comment) {
111 super.setInternalComment(comment);
112 }
113
114 /**
115 * Override the project working directory.
116 *
117 * @param localPath The path on disk.
118 */
119 public void setLocalpath(Path localPath) {
120 this.localPath = localPath.toString();
121 }
122}
Note: See TracBrowser for help on using the repository browser.