1 | /*
|
---|
2 | * Copyright 2001-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 |
|
---|
23 | /**
|
---|
24 | * Performs Label commands to Microsoft Visual SourceSafe.
|
---|
25 | *
|
---|
26 | * @ant.task name="vsslabel" category="scm"
|
---|
27 | */
|
---|
28 | public class MSVSSLABEL extends MSVSS {
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * Builds a command line to execute ss.
|
---|
32 | * @return The constructed commandline.
|
---|
33 | */
|
---|
34 | Commandline buildCmdLine() {
|
---|
35 | Commandline commandLine = new Commandline();
|
---|
36 |
|
---|
37 | // first off, make sure that we've got a command and a vssdir and a label ...
|
---|
38 | if (getVsspath() == null) {
|
---|
39 | throw new BuildException("vsspath attribute must be set!", getLocation());
|
---|
40 | }
|
---|
41 |
|
---|
42 | String label = getLabel();
|
---|
43 | if (label.equals("")) {
|
---|
44 | String msg = "label attribute must be set!";
|
---|
45 | throw new BuildException(msg, getLocation());
|
---|
46 | }
|
---|
47 |
|
---|
48 | // build the command line from what we got the format is
|
---|
49 | // ss Label VSS items [-C] [-H] [-I-] [-Llabel] [-N] [-O] [-V] [-Y] [-?]
|
---|
50 | // as specified in the SS.EXE help
|
---|
51 | commandLine.setExecutable(getSSCommand());
|
---|
52 | commandLine.createArgument().setValue(COMMAND_LABEL);
|
---|
53 |
|
---|
54 | // VSS items
|
---|
55 | commandLine.createArgument().setValue(getVsspath());
|
---|
56 | // -C
|
---|
57 | commandLine.createArgument().setValue(getComment());
|
---|
58 | // -I- or -I-Y or -I-N
|
---|
59 | commandLine.createArgument().setValue(getAutoresponse());
|
---|
60 | // -L Specify the new label on the command line (instead of being prompted)
|
---|
61 | commandLine.createArgument().setValue(label);
|
---|
62 | // -V Label an existing file or project version
|
---|
63 | commandLine.createArgument().setValue(getVersion());
|
---|
64 | // -Y
|
---|
65 | commandLine.createArgument().setValue(getLogin());
|
---|
66 |
|
---|
67 | return commandLine;
|
---|
68 | }
|
---|
69 |
|
---|
70 | /**
|
---|
71 | * Label to apply in SourceSafe.
|
---|
72 | *
|
---|
73 | * @param label The label to apply.
|
---|
74 | *
|
---|
75 | * @ant.attribute group="required"
|
---|
76 | */
|
---|
77 | public void setLabel(String label) {
|
---|
78 | super.setInternalLabel(label);
|
---|
79 | }
|
---|
80 |
|
---|
81 | /**
|
---|
82 | * Version to label.
|
---|
83 | *
|
---|
84 | * @param version The version to label.
|
---|
85 | */
|
---|
86 | public void setVersion(String version) {
|
---|
87 | super.setInternalVersion(version);
|
---|
88 | }
|
---|
89 |
|
---|
90 | /**
|
---|
91 | * Comment to apply to files labeled in SourceSafe.
|
---|
92 | *
|
---|
93 | * @param comment The comment to apply in SourceSafe
|
---|
94 | */
|
---|
95 | public void setComment(String comment) {
|
---|
96 | super.setInternalComment(comment);
|
---|
97 | }
|
---|
98 |
|
---|
99 | /**
|
---|
100 | * Autoresponce behaviour. Valid options are Y and N.
|
---|
101 | *
|
---|
102 | * @param response The auto response value.
|
---|
103 | */
|
---|
104 | public void setAutoresponse(String response) {
|
---|
105 | super.setInternalAutoResponse(response);
|
---|
106 | }
|
---|
107 | }
|
---|