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-ffa450edef68master
| @@ -126,6 +126,17 @@ label only one will be used in the order version, date, label.</p> | |||
| <td>label</td> | |||
| <td>a label to get for</td> | |||
| </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> | |||
| <p>Note that only one of version, date or label should be specified</p> | |||
| <h3>Examples</h3> | |||
| @@ -201,6 +212,12 @@ project.</p> | |||
| <td>The comment to use for this label. Empty or '-' for no comment.</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> | |||
| <h3>Examples</h3> | |||
| <blockquote> | |||
| @@ -242,5 +242,7 @@ public abstract class MSVSS extends Task { | |||
| public static final String VALUE_NO = "-N"; | |||
| /** */ | |||
| public static final String VALUE_YES = "-Y"; | |||
| /** */ | |||
| public static final String FLAG_QUIET = "-O-"; | |||
| } | |||
| @@ -74,42 +74,53 @@ import java.io.File; | |||
| * <td>login</td> | |||
| * <td>username,password</td> | |||
| * <td>No</td> | |||
| * <tr> | |||
| * </tr> | |||
| * <tr> | |||
| * <td>vsspath</td> | |||
| * <td>SourceSafe path</td> | |||
| * <td>Yes</td> | |||
| * <tr> | |||
| * </tr> | |||
| * <tr> | |||
| * <td>localpath</td> | |||
| * <td>Override the working directory and get to the specified path</td> | |||
| * <td>No</td> | |||
| * <tr> | |||
| * </tr> | |||
| * <tr> | |||
| * <td>writable</td> | |||
| * <td>true or false</td> | |||
| * <td>No</td> | |||
| * <tr> | |||
| * </tr> | |||
| * <tr> | |||
| * <td>recursive</td> | |||
| * <td>true or false</td> | |||
| * <td>No</td> | |||
| * <tr> | |||
| * </tr> | |||
| * <tr> | |||
| * <td>version</td> | |||
| * <td>a version number to get</td> | |||
| * <td>No</td> | |||
| * <tr> | |||
| * </tr> | |||
| * <tr> | |||
| * <td>date</td> | |||
| * <td>a date stamp to get at</td> | |||
| * <td>No</td> | |||
| * <tr> | |||
| * </tr> | |||
| * <tr> | |||
| * <td>label</td> | |||
| * <td>a label to get for</td> | |||
| * <td>No</td> | |||
| * </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> | |||
| * <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_Label = null; | |||
| private String m_AutoResponse = null; | |||
| private boolean m_Quiet = false; | |||
| /** | |||
| * Executes the task. | |||
| @@ -156,6 +168,8 @@ public class MSVSSGET extends MSVSS { | |||
| getLocalpathCommand(commandLine); | |||
| // -I- or -I-Y or -I-N | |||
| getAutoresponse(commandLine); | |||
| // -O- | |||
| getQuietCommand(commandLine); | |||
| // -R | |||
| getRecursiveCommand(commandLine); | |||
| // -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 | |||
| */ | |||
| @@ -93,13 +93,25 @@ import org.apache.tools.ant.types.Commandline; | |||
| * <td>An existing file or project version to label</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> | |||
| * <tr> | |||
| * <td>comment</td> | |||
| * <td>The comment to use for this label. Empty or '-' for no comment.</td> | |||
| * <td>No</td> | |||
| * </tr> | |||
| * | |||
| * </table> | |||
| * | |||
| * @author Phillip Wells | |||
| */ | |||
| public class MSVSSLABEL extends MSVSS | |||
| { | |||
| private String m_AutoResponse = null; | |||
| private String m_Label = null; | |||
| private String m_Version = null; | |||
| private String m_Comment = "-"; | |||
| @@ -140,8 +152,8 @@ public class MSVSSLABEL extends MSVSS | |||
| // -C | |||
| commandLine.createArgument().setValue("-C"+getComment()); | |||
| // -I- | |||
| commandLine.createArgument().setValue("-I-"); // ignore all errors | |||
| // -I- or -I-Y or -I-N | |||
| getAutoresponse(commandLine); | |||
| // -L | |||
| // Specify the new label on the command line (instead of being prompted) | |||
| @@ -243,4 +255,33 @@ public class MSVSSLABEL extends MSVSS | |||
| public String getComment() { | |||
| 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 | |||
| } | |||
| } | |||