Browse Source

added autoresponse attribute to <vssget> and <vsslabel> as well as a quiet

attribute to <vssget>.

Submitted by:	Jon Skeet <jon.skeet@peramon.com>

Note that I don't use VSS, so this patch has not been tested for
functionality (it compiles and looks OK, that's all I can check).


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269398 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 24 years ago
parent
commit
8ddd67ad87
4 changed files with 97 additions and 10 deletions
  1. +17
    -0
      docs/manual/OptionalTasks/vss.html
  2. +2
    -0
      src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java
  3. +34
    -7
      src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSGET.java
  4. +44
    -3
      src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSLABEL.java

+ 17
- 0
docs/manual/OptionalTasks/vss.html View File

@@ -126,6 +126,17 @@ label only one will be used in the order version, date, label.</p>
<td>label</td> <td>label</td>
<td>a label to get for</td> <td>a label to get for</td>
</tr> </tr>
<tr>
<td>quiet</td>
<td>suppress output (off by default)</td>
<td>No</td>
</tr>
<tr>
<td>autoresponse</td>
<td>What to respond with (sets the -I option). By default, -I- is
used; values of Y or N will be appended to this.</td>
<td>No</td>
</tr>
</table> </table>
<p>Note that only one of version, date or label should be specified</p> <p>Note that only one of version, date or label should be specified</p>
<h3>Examples</h3> <h3>Examples</h3>
@@ -201,6 +212,12 @@ project.</p>
<td>The comment to use for this label. Empty or '-' for no comment.</td> <td>The comment to use for this label. Empty or '-' for no comment.</td>
<td>No</td> <td>No</td>
</tr> </tr>
<tr>
<td>autoresponse</td>
<td>What to respond with (sets the -I option). By default, -I- is
used; values of Y or N will be appended to this.</td>
<td>No</td>
</tr>
</table> </table>
<h3>Examples</h3> <h3>Examples</h3>
<blockquote> <blockquote>


+ 2
- 0
src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java View File

@@ -242,5 +242,7 @@ public abstract class MSVSS extends Task {
public static final String VALUE_NO = "-N"; public static final String VALUE_NO = "-N";
/** */ /** */
public static final String VALUE_YES = "-Y"; public static final String VALUE_YES = "-Y";
/** */
public static final String FLAG_QUIET = "-O-";
} }



+ 34
- 7
src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSGET.java View File

@@ -74,42 +74,53 @@ import java.io.File;
* <td>login</td> * <td>login</td>
* <td>username,password</td> * <td>username,password</td>
* <td>No</td> * <td>No</td>
* <tr>
* </tr>
* <tr> * <tr>
* <td>vsspath</td> * <td>vsspath</td>
* <td>SourceSafe path</td> * <td>SourceSafe path</td>
* <td>Yes</td> * <td>Yes</td>
* <tr>
* </tr>
* <tr> * <tr>
* <td>localpath</td> * <td>localpath</td>
* <td>Override the working directory and get to the specified path</td> * <td>Override the working directory and get to the specified path</td>
* <td>No</td> * <td>No</td>
* <tr>
* </tr>
* <tr> * <tr>
* <td>writable</td> * <td>writable</td>
* <td>true or false</td> * <td>true or false</td>
* <td>No</td> * <td>No</td>
* <tr>
* </tr>
* <tr> * <tr>
* <td>recursive</td> * <td>recursive</td>
* <td>true or false</td> * <td>true or false</td>
* <td>No</td> * <td>No</td>
* <tr>
* </tr>
* <tr> * <tr>
* <td>version</td> * <td>version</td>
* <td>a version number to get</td> * <td>a version number to get</td>
* <td>No</td> * <td>No</td>
* <tr>
* </tr>
* <tr> * <tr>
* <td>date</td> * <td>date</td>
* <td>a date stamp to get at</td> * <td>a date stamp to get at</td>
* <td>No</td> * <td>No</td>
* <tr>
* </tr>
* <tr> * <tr>
* <td>label</td> * <td>label</td>
* <td>a label to get for</td> * <td>a label to get for</td>
* <td>No</td> * <td>No</td>
* </tr>
* <tr>
* <td>quiet</td>
* <td>suppress output (off by default)</td>
* <td>No</td>
* </tr>
* <tr> * <tr>
* <td>autoresponse</td>
* <td>What to respond with (sets the -I option). By default, -I- is
* used; values of Y or N will be appended to this.</td>
* <td>No</td>
* </tr>
* </table> * </table>
* <p>Note that only one of version, date or label should be specified</p> * <p>Note that only one of version, date or label should be specified</p>
* *
@@ -125,6 +136,7 @@ public class MSVSSGET extends MSVSS {
private String m_Date = null; private String m_Date = null;
private String m_Label = null; private String m_Label = null;
private String m_AutoResponse = null; private String m_AutoResponse = null;
private boolean m_Quiet = false;


/** /**
* Executes the task. * Executes the task.
@@ -156,6 +168,8 @@ public class MSVSSGET extends MSVSS {
getLocalpathCommand(commandLine); getLocalpathCommand(commandLine);
// -I- or -I-Y or -I-N // -I- or -I-Y or -I-N
getAutoresponse(commandLine); getAutoresponse(commandLine);
// -O-
getQuietCommand(commandLine);
// -R // -R
getRecursiveCommand(commandLine); getRecursiveCommand(commandLine);
// -V // -V
@@ -222,6 +236,19 @@ public class MSVSSGET extends MSVSS {
} }
} }


/**
* Sets/clears quiet mode
*/
public final void setQuiet (boolean quiet) {
this.m_Quiet=quiet;
}
public void getQuietCommand (Commandline cmd) {
if (m_Quiet) {
cmd.createArgument().setValue (FLAG_QUIET);
}
}
/** /**
* Set behaviour, used in get command to make files that are 'got' writable * Set behaviour, used in get command to make files that are 'got' writable
*/ */


+ 44
- 3
src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSLABEL.java View File

@@ -93,13 +93,25 @@ import org.apache.tools.ant.types.Commandline;
* <td>An existing file or project version to label</td> * <td>An existing file or project version to label</td>
* <td>No</td> * <td>No</td>
* </tr> * </tr>
* <tr>
* <td>autoresponse</td>
* <td>What to respond with (sets the -I option). By default, -I- is
* used; values of Y or N will be appended to this.</td>
* <td>No</td>
* </tr>
* <tr>
* <td>comment</td>
* <td>The comment to use for this label. Empty or '-' for no comment.</td>
* <td>No</td>
* </tr>
*
* </table> * </table>
* *
* @author Phillip Wells * @author Phillip Wells
*/ */
public class MSVSSLABEL extends MSVSS public class MSVSSLABEL extends MSVSS
{ {

private String m_AutoResponse = null;
private String m_Label = null; private String m_Label = null;
private String m_Version = null; private String m_Version = null;
private String m_Comment = "-"; private String m_Comment = "-";
@@ -140,8 +152,8 @@ public class MSVSSLABEL extends MSVSS
// -C // -C
commandLine.createArgument().setValue("-C"+getComment()); commandLine.createArgument().setValue("-C"+getComment());


// -I-
commandLine.createArgument().setValue("-I-"); // ignore all errors
// -I- or -I-Y or -I-N
getAutoresponse(commandLine);


// -L // -L
// Specify the new label on the command line (instead of being prompted) // Specify the new label on the command line (instead of being prompted)
@@ -243,4 +255,33 @@ public class MSVSSLABEL extends MSVSS
public String getComment() { public String getComment() {
return m_Comment; return m_Comment;
} }
public void setAutoresponse(String response){
if ( response.equals("") || response.equals("null") ) {
m_AutoResponse = null;
} else {
m_AutoResponse = response;
}
}
/**
* Checks the value set for the autoResponse.
* if it equals "Y" then we return -I-Y
* if it equals "N" then we return -I-N
* otherwise we return -I
*/
public void getAutoresponse(Commandline cmd) {
if ( m_AutoResponse == null) {
cmd.createArgument().setValue(FLAG_AUTORESPONSE_DEF);
} else if ( m_AutoResponse.equalsIgnoreCase("Y")) {
cmd.createArgument().setValue(FLAG_AUTORESPONSE_YES);
} else if ( m_AutoResponse.equalsIgnoreCase("N")) {
cmd.createArgument().setValue(FLAG_AUTORESPONSE_NO);
}else {
cmd.createArgument().setValue(FLAG_AUTORESPONSE_DEF);
} // end of else

}
} }

Loading…
Cancel
Save