jesse 2003/04/14 21:26:52
Modified:src/main/org/apache/tools/ant/taskdefs/optional/vss
MSVSS.java MSVSSADD.java MSVSSCHECKOUT.java
MSVSSCREATE.java MSVSSConstants.java MSVSSGET.java
MSVSSLABEL.java
src/etc/testcases/taskdefs/optional/vss vss.xml
Log:
Add ability to overwrite or skip writable files during 'get latest' or
'checkout'
Add ability to specify timestamps for files retrieved during 'get latest' or
'checkout'
Fix label length issues
Other minor fixes unearthed after major refactoring of VSS tasks
PR: #11562 #8451 #4387 #12793 #14174 #13532 #14463
Submitted by: Nigel Magnay, Keying Xi, and others
Revision ChangesPath
1.29 +195 -14
ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java
Index: MSVSS.java
===
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- MSVSS.java10 Feb 2003 14:14:28 - 1.28
+++ MSVSS.java15 Apr 2003 04:26:51 - 1.29
@@ -54,6 +54,7 @@
package org.apache.tools.ant.taskdefs.optional.vss;
+import org.apache.tools.ant.types.EnumeratedAttribute;
import java.io.File;
import java.io.IOException;
import java.text.DateFormat;
@@ -126,10 +127,16 @@
private boolean m_Writable = false;
/** Fail on error defaults to true */
private boolean m_FailOnError = true;
+/** Get local copy for checkout defaults to true */
+private boolean m_getLocalCopy = true;
/** Number of days offset for History */
private int m_NumDays = Integer.MIN_VALUE;
/** Date format for History */
private DateFormat m_DateFormat =
DateFormat.getDateInstance(DateFormat.SHORT);
+/** Timestamp for retreived files */
+private CurrentModUpdated m_timestamp = null;
+/** Behaviour for writable files */
+private WritableFiles m_writablefiles = null;
/**
* Each sub-class must implemnt this method and return the constructed
@@ -197,6 +204,15 @@
}
/**
+ * Sets behaviour, whether task should fail if there is an error creating
+ * the project.; optional, default true
+ * @param failOnError True if task should fail on any error.
+ */
+public final void setFailOnError (boolean failOnError) {
+m_FailOnError = failOnError;
+}
+
+/**
* Executes the task. br
* Builds a command line to execute ss.exe and then calls Exec's run
method
* to execute the command line.
@@ -208,7 +224,7 @@
Commandline commandLine = buildCmdLine();
result = run(commandLine);
if (result != 0 getFailOnError()) {
-String msg = Failed executing: + commandLine.toString()
+String msg = Failed executing: +
formatCommandLine(commandLine)
+ With a return code of + result;
throw new BuildException(msg, getLocation());
}
@@ -292,6 +308,18 @@
m_Writable = writable;
}
+protected void setInternalFileTimeStamp(CurrentModUpdated timestamp) {
+m_timestamp = timestamp;
+}
+
+protected void setInternalWritableFiles(WritableFiles files) {
+m_writablefiles = files;
+}
+
+protected void setInternalGetLocalCopy(boolean get) {
+m_getLocalCopy = get;
+}
+
/**
* Gets the sscommand string. ss or c:\path\to\ss
*
@@ -344,10 +372,24 @@
/**
* Gets the label string. -Lbuild1
*
+ * Max label length is 32 chars
+ *
* @returnAn empty string if label is not set.
*/
protected String getLabel() {
-return m_Label != null ? FLAG_LABEL + m_Label : ;
+if (m_Label != null) {
+if (m_Label.length() 31) {
+String label = m_Label.substring(0, 30);
+log(Label is longer than 31 characters, truncated to: +
label, Project.MSG_WARN);
+return FLAG_LABEL + label;
+}
+else {
+return FLAG_LABEL + m_Label;
+}
+}
+else {
+return ;
+}
}
/**
@@ -363,18 +405,33 @@
* Gets the version string. Returns the first specified of version
-V1.0,
* date -Vd01.01.01, label -Vlbuild1.
*
- * @returnAn empty string if a version is not set.
+ * @returnAn empty string if a version, date and label are not set.
*/
-protected String getVersion() {
+protected String getVersionDateLabel() {
if (m_Version != null) {
return FLAG_VERSION +