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: * Performs CheckIn commands to Microsoft Visual SourceSafe.
027: *
028: * @ant.task name="vsscheckin" category="scm"
029: */
030: public class MSVSSCHECKIN extends MSVSS {
031:
032: /**
033: * Builds a command line to execute ss.
034: * @return The constructed commandline.
035: */
036: protected Commandline buildCmdLine() {
037: Commandline commandLine = new Commandline();
038:
039: // first off, make sure that we've got a command and a vssdir ...
040: if (getVsspath() == null) {
041: String msg = "vsspath attribute must be set!";
042: throw new BuildException(msg, getLocation());
043: }
044:
045: // build the command line from what we got the format is
046: // ss Checkin VSS items [-H] [-C] [-I-] [-N] [-O] [-R] [-W] [-Y] [-?]
047: // as specified in the SS.EXE help
048: commandLine.setExecutable(getSSCommand());
049: commandLine.createArgument().setValue(COMMAND_CHECKIN);
050:
051: // VSS items
052: commandLine.createArgument().setValue(getVsspath());
053: // -GL
054: commandLine.createArgument().setValue(getLocalpath());
055: // -I- or -I-Y or -I-N
056: commandLine.createArgument().setValue(getAutoresponse());
057: // -R
058: commandLine.createArgument().setValue(getRecursive());
059: // -W
060: commandLine.createArgument().setValue(getWritable());
061: // -Y
062: commandLine.createArgument().setValue(getLogin());
063: // -C
064: commandLine.createArgument().setValue(getComment());
065:
066: return commandLine;
067: }
068:
069: /**
070: * Override the project working directory.
071: *
072: * @param localPath The path on disk.
073: */
074: public void setLocalpath(Path localPath) {
075: super .setInternalLocalPath(localPath.toString());
076: }
077:
078: /**
079: * Check-in files recursively. Defaults to false.
080: *
081: * @param recursive The boolean value for recursive.
082: */
083: public void setRecursive(boolean recursive) {
084: super .setInternalRecursive(recursive);
085: }
086:
087: /**
088: * Unset the READ-ONLY flag on local copies of files checked-in to VSS.
089: * Defaults to false.
090: *
091: * @param writable The boolean value for writable.
092: */
093: public final void setWritable(boolean writable) {
094: super .setInternalWritable(writable);
095: }
096:
097: /**
098: * Autoresponce behaviour. Valid options are Y and N.
099: *
100: * @param response The auto response value.
101: */
102: public void setAutoresponse(String response) {
103: super .setInternalAutoResponse(response);
104: }
105:
106: /**
107: * Comment to apply to files checked-in to SourceSafe.
108: *
109: * @param comment The comment to apply in SourceSafe
110: */
111: public void setComment(String comment) {
112: super.setInternalComment(comment);
113: }
114: }
|