1 | /*
|
---|
2 | * Copyright 2000-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 |
|
---|
18 | package org.apache.tools.ant.taskdefs.optional.vss;
|
---|
19 |
|
---|
20 | import org.apache.tools.ant.BuildException;
|
---|
21 | import org.apache.tools.ant.types.Commandline;
|
---|
22 | import org.apache.tools.ant.types.Path;
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * Perform Get commands from Microsoft Visual SourceSafe.
|
---|
26 | *
|
---|
27 | * @ant.task name="vssget" category="scm"
|
---|
28 | * @ant.attribute.group name="vdl" description="Only one of version, date or label"
|
---|
29 | */
|
---|
30 | public class MSVSSGET extends MSVSS {
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * Builds a command line to execute ss.
|
---|
34 | * @return The constructed commandline.
|
---|
35 | */
|
---|
36 | Commandline buildCmdLine() {
|
---|
37 | Commandline commandLine = new Commandline();
|
---|
38 |
|
---|
39 | // build the command line from what we got the format is
|
---|
40 | // ss Get VSS items [-G] [-H] [-I-] [-N] [-O] [-R] [-V] [-W] [-Y] [-?]
|
---|
41 | // as specified in the SS.EXE help
|
---|
42 | commandLine.setExecutable(getSSCommand());
|
---|
43 | commandLine.createArgument().setValue(COMMAND_GET);
|
---|
44 |
|
---|
45 | if (getVsspath() == null) {
|
---|
46 | throw new BuildException("vsspath attribute must be set!", getLocation());
|
---|
47 | }
|
---|
48 | commandLine.createArgument().setValue(getVsspath());
|
---|
49 |
|
---|
50 | // -GL
|
---|
51 | commandLine.createArgument().setValue(getLocalpath());
|
---|
52 | // -I- or -I-Y or -I-N
|
---|
53 | commandLine.createArgument().setValue(getAutoresponse());
|
---|
54 | // -O-
|
---|
55 | commandLine.createArgument().setValue(getQuiet());
|
---|
56 | // -R
|
---|
57 | commandLine.createArgument().setValue(getRecursive());
|
---|
58 | // -V
|
---|
59 | commandLine.createArgument().setValue(getVersionDateLabel());
|
---|
60 | // -W
|
---|
61 | commandLine.createArgument().setValue(getWritable());
|
---|
62 | // -Y
|
---|
63 | commandLine.createArgument().setValue(getLogin());
|
---|
64 | // -G
|
---|
65 | commandLine.createArgument().setValue(getFileTimeStamp());
|
---|
66 | // -GWS or -GWR
|
---|
67 | commandLine.createArgument().setValue(getWritableFiles());
|
---|
68 |
|
---|
69 | return commandLine;
|
---|
70 | }
|
---|
71 |
|
---|
72 | /**
|
---|
73 | * Override the project working directory.
|
---|
74 | *
|
---|
75 | * @param localPath The path on disk.
|
---|
76 | */
|
---|
77 | public void setLocalpath(Path localPath) {
|
---|
78 | super.setInternalLocalPath(localPath.toString());
|
---|
79 | }
|
---|
80 |
|
---|
81 | /**
|
---|
82 | * Get files recursively. Defaults to false.
|
---|
83 | *
|
---|
84 | * @param recursive The boolean value for recursive.
|
---|
85 | */
|
---|
86 | public final void setRecursive(boolean recursive) {
|
---|
87 | super.setInternalRecursive(recursive);
|
---|
88 | }
|
---|
89 |
|
---|
90 | /**
|
---|
91 | * Enable quiet mode. Defaults to false.
|
---|
92 | *
|
---|
93 | * @param quiet The boolean value for quiet.
|
---|
94 | */
|
---|
95 | public final void setQuiet (boolean quiet) {
|
---|
96 | super.setInternalQuiet(quiet);
|
---|
97 | }
|
---|
98 |
|
---|
99 | /**
|
---|
100 | * Unset the READ-ONLY flag on files retrieved from VSS. Defaults to false.
|
---|
101 | *
|
---|
102 | * @param writable The boolean value for writable.
|
---|
103 | */
|
---|
104 | public final void setWritable(boolean writable) {
|
---|
105 | super.setInternalWritable(writable);
|
---|
106 | }
|
---|
107 |
|
---|
108 | /**
|
---|
109 | * Version to get.
|
---|
110 | *
|
---|
111 | * @param version The version to get.
|
---|
112 | *
|
---|
113 | * @ant.attribute group="vdl"
|
---|
114 | */
|
---|
115 | public void setVersion(String version) {
|
---|
116 | super.setInternalVersion(version);
|
---|
117 | }
|
---|
118 |
|
---|
119 | /**
|
---|
120 | * Date to get.
|
---|
121 | *
|
---|
122 | * @param date The date to get.
|
---|
123 | *
|
---|
124 | * @ant.attribute group="vdl"
|
---|
125 | */
|
---|
126 | public void setDate(String date) {
|
---|
127 | super.setInternalDate(date);
|
---|
128 | }
|
---|
129 |
|
---|
130 | /**
|
---|
131 | * Label to get.
|
---|
132 | *
|
---|
133 | * @param label The label to get.
|
---|
134 | *
|
---|
135 | * @ant.attribute group="vdl"
|
---|
136 | */
|
---|
137 | public void setLabel(String label) {
|
---|
138 | super.setInternalLabel(label);
|
---|
139 | }
|
---|
140 |
|
---|
141 | /**
|
---|
142 | * Autoresponce behaviour. Valid options are Y and N.
|
---|
143 | *
|
---|
144 | * @param response The auto response value.
|
---|
145 | */
|
---|
146 | public void setAutoresponse(String response) {
|
---|
147 | super.setInternalAutoResponse(response);
|
---|
148 | }
|
---|
149 |
|
---|
150 | /**
|
---|
151 | * Date and time stamp given to the local copy. Defaults to <code>current</code>.
|
---|
152 | *
|
---|
153 | * @param timestamp The file time stamping behaviour.
|
---|
154 | */
|
---|
155 | public void setFileTimeStamp(CurrentModUpdated timestamp) {
|
---|
156 | super.setInternalFileTimeStamp(timestamp);
|
---|
157 | }
|
---|
158 |
|
---|
159 | /**
|
---|
160 | * Action taken when local files are writable. Defaults to <code>fail</code>.
|
---|
161 | * <p>
|
---|
162 | * Due to ss.exe returning with an exit code of '100' for both errors and when
|
---|
163 | * a file has been skipped, <code>failonerror</code> is set to false when using
|
---|
164 | * the <code>skip</code> option.
|
---|
165 | *
|
---|
166 | * @param files The action to take.
|
---|
167 | */
|
---|
168 | public void setWritableFiles(WritableFiles files) {
|
---|
169 | super.setInternalWritableFiles(files);
|
---|
170 | }
|
---|
171 | }
|
---|