001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: *
017: */
018:
019: package org.apache.tools.ant.taskdefs.optional.vss;
020:
021: import org.apache.tools.ant.BuildException;
022: import org.apache.tools.ant.types.Commandline;
023: import org.apache.tools.ant.types.Path;
024:
025: /**
026: * Perform Get commands from Microsoft Visual SourceSafe.
027: *
028: * @ant.task name="vssget" category="scm"
029: * @ant.attribute.group name="vdl" description="Only one of version, date or label"
030: */
031: public class MSVSSGET extends MSVSS {
032:
033: /**
034: * Builds a command line to execute ss.
035: * @return The constructed commandline.
036: */
037: Commandline buildCmdLine() {
038: Commandline commandLine = new Commandline();
039:
040: // build the command line from what we got the format is
041: // ss Get VSS items [-G] [-H] [-I-] [-N] [-O] [-R] [-V] [-W] [-Y] [-?]
042: // as specified in the SS.EXE help
043: commandLine.setExecutable(getSSCommand());
044: commandLine.createArgument().setValue(COMMAND_GET);
045:
046: if (getVsspath() == null) {
047: throw new BuildException("vsspath attribute must be set!",
048: getLocation());
049: }
050: commandLine.createArgument().setValue(getVsspath());
051:
052: // -GL
053: commandLine.createArgument().setValue(getLocalpath());
054: // -I- or -I-Y or -I-N
055: commandLine.createArgument().setValue(getAutoresponse());
056: // -O-
057: commandLine.createArgument().setValue(getQuiet());
058: // -R
059: commandLine.createArgument().setValue(getRecursive());
060: // -V
061: commandLine.createArgument().setValue(getVersionDateLabel());
062: // -W
063: commandLine.createArgument().setValue(getWritable());
064: // -Y
065: commandLine.createArgument().setValue(getLogin());
066: // -G
067: commandLine.createArgument().setValue(getFileTimeStamp());
068: // -GWS or -GWR
069: commandLine.createArgument().setValue(getWritableFiles());
070:
071: return commandLine;
072: }
073:
074: /**
075: * Override the project working directory.
076: *
077: * @param localPath The path on disk.
078: */
079: public void setLocalpath(Path localPath) {
080: super .setInternalLocalPath(localPath.toString());
081: }
082:
083: /**
084: * Get files recursively. Defaults to false.
085: *
086: * @param recursive The boolean value for recursive.
087: */
088: public final void setRecursive(boolean recursive) {
089: super .setInternalRecursive(recursive);
090: }
091:
092: /**
093: * Enable quiet mode. Defaults to false.
094: *
095: * @param quiet The boolean value for quiet.
096: */
097: public final void setQuiet(boolean quiet) {
098: super .setInternalQuiet(quiet);
099: }
100:
101: /**
102: * Unset the READ-ONLY flag on files retrieved from VSS. Defaults to false.
103: *
104: * @param writable The boolean value for writable.
105: */
106: public final void setWritable(boolean writable) {
107: super .setInternalWritable(writable);
108: }
109:
110: /**
111: * Version to get.
112: *
113: * @param version The version to get.
114: *
115: * @ant.attribute group="vdl"
116: */
117: public void setVersion(String version) {
118: super .setInternalVersion(version);
119: }
120:
121: /**
122: * Date to get.
123: *
124: * @param date The date to get.
125: *
126: * @ant.attribute group="vdl"
127: */
128: public void setDate(String date) {
129: super .setInternalDate(date);
130: }
131:
132: /**
133: * Label to get.
134: *
135: * @param label The label to get.
136: *
137: * @ant.attribute group="vdl"
138: */
139: public void setLabel(String label) {
140: super .setInternalLabel(label);
141: }
142:
143: /**
144: * Autoresponce behaviour. Valid options are Y and N.
145: *
146: * @param response The auto response value.
147: */
148: public void setAutoresponse(String response) {
149: super .setInternalAutoResponse(response);
150: }
151:
152: /**
153: * Date and time stamp given to the local copy. Defaults to <code>current</code>.
154: *
155: * @param timestamp The file time stamping behaviour.
156: */
157: public void setFileTimeStamp(CurrentModUpdated timestamp) {
158: super .setInternalFileTimeStamp(timestamp);
159: }
160:
161: /**
162: * Action taken when local files are writable. Defaults to <code>fail</code>.
163: * <p>
164: * Due to ss.exe returning with an exit code of '100' for both errors and when
165: * a file has been skipped, <code>failonerror</code> is set to false when using
166: * the <code>skip</code> option.
167: *
168: * @param files The action to take.
169: */
170: public void setWritableFiles(WritableFiles files) {
171: super.setInternalWritableFiles(files);
172: }
173: }
|