diff --git a/docs/manual/OptionalTasks/vsshistory.html b/docs/manual/OptionalTasks/vsshistory.html index dc7421614..ad4e89437 100644 --- a/docs/manual/OptionalTasks/vsshistory.html +++ b/docs/manual/OptionalTasks/vsshistory.html @@ -12,112 +12,124 @@ Task to perform HISTORY commands to Microsoft Visual Source Safe.
Attribute | Values | Required | |
---|---|---|---|
login | username,password | No | |
vsspath | SourceSafe path | Yes | |
ssdir | -directory where ss.exe resides. By default the task
+ | directory where ss.exe resides. By default the task
expects it to be in the PATH. |
No |
serverPath | -directory where srssafe.ini resides. |
- No | +|
serverPath | +directory where srssafe.ini resides. |
+ No | |
fromDate | Start date for comparison | See below | |
toDate | Start date for comparison | See below | |
dateFormat | +Format of dates in fromDate and toDate. Used when calculating dates with + the numdays attribute. This string uses the formatting rules of SimpleDateFormat. + Defaults to DateFormat.SHORT. | +No | +|
fromLabel | Start label for comparison | No | |
toLabel | Start label for comparison | No | |
numdays | The number of days for comparison. | See below | |
outputfilename | +|||
output | File to write the diff. | No | |
recursive | true or false | No | -|
style | -brief or codediff or nofile. The default is brief. | +brief, codediff, default or nofile. The default is default. | No | -
There are different ways to specify what time-frame you wish to evaluate:
fromDate
and toDate
toDate
fromDate
toDate
and (negative!) numDays
fromDate
and numDays
fromDate
and toDate
toDate
fromDate
toDate
and (negative!) numDays
fromDate
and numDays
--<vsshistory recursive="true" - fromLabel="Release1" - toLabel="Release2"/> ++<vsshistory vsspath="/myProject" recursive="true" + fromLabel="Release1" + toLabel="Release2"/>
Shows all changes between "Release1" and "Release2".
--<vsshistory recursive="true" - fromDate="01.01.2001" - toDate="31.03.2001"/> ++<vsshistory vsspath="/myProject" recursive="true" + fromDate="01.01.2001" + toDate="31.03.2001"/>
Shows all changes between January 1st 2001 and March 31st 2001 (in Germany, date must be specified according to your locale).
---<vsshistory recursive="true" - numDays="-14" - toDate="31.01.2001"/> ++-+<tstamp> + <format property="to.tstamp" pattern="M-d-yy;h:mma" /> +</tstamp> + +<vsshistory vsspath="/myProject" recursive="true" + numDays="-14" + dateFormat="M-d-yy;h:mma" + toDate="${to.tstamp}"/>Shows all changes in the 14 days before January 31st 2001 (in Germany, date must be specified according to your locale).
+Shows all changes in the 14 days before today.
Copyright © 2000,2001 Apache Software Foundation. All rights diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSHISTORY.java b/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSHISTORY.java index 47ecdf063..b34caa0f7 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSHISTORY.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSHISTORY.java @@ -57,74 +57,29 @@ package org.apache.tools.ant.taskdefs.optional.vss; import org.apache.tools.ant.*; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.EnumeratedAttribute; +import java.io.File; import java.util.*; import java.text.*; /** * Task to perform HISTORY commands to Microsoft Visual Source Safe. - *
- * The following attributes are interpreted: - *
- *
* * @author Balazs Fejes 2 + * @author Glenn_Twiggs@bmc.com */ public class MSVSSHISTORY extends MSVSS { private String m_FromDate = null; private String m_ToDate = null; + private DateFormat m_DateFormat = + DateFormat.getDateInstance(DateFormat.SHORT); + private String m_FromLabel = null; private String m_ToLabel = null; private String m_OutputFileName = null; private String m_User = null; private int m_NumDays = Integer.MIN_VALUE; - private String m_Style = "-B"; + private String m_Style = ""; private boolean m_Recursive = false; public static final String VALUE_FROMDATE = "~d"; @@ -132,7 +87,7 @@ public class MSVSSHISTORY extends MSVSS { public static final String FLAG_OUTPUT = "-O"; public static final String FLAG_USER = "-U"; - + /** * Executes the task. *- * - *Attribute - *Values - *Required - *- * - *login - *username,password - *No - *- * - *vsspath - *SourceSafe path - *Yes - *- * - *ssdir - *directory where - *ss.exe
resides. By default the task - * expects it to be in the PATH.No - *- * - *startdate - *Start date for comparison - *Yes - *- * - *outputfilename - *File to write the diff. - *Yes - *- * - *numdays - *The number of days for comparison. The default value is -2 days. - *No - *- * recursive - *true or false - *No - *- * - * style - *brief or codediff or nofile. The default is brief. - *No - *- * @@ -163,9 +118,6 @@ public class MSVSSHISTORY extends MSVSS { // -I- commandLine.createArgument().setValue("-I-"); // ignore all errors - // -R - getRecursiveCommand(commandLine); - // -V // Label an existing file or project version getVersionDateCommand(commandLine); @@ -177,7 +129,9 @@ public class MSVSSHISTORY extends MSVSS { } // -B / -D / -F- - commandLine.createArgument().setValue(m_Style); + if (m_Style.length() > 0) { + commandLine.createArgument().setValue(m_Style); + } // -Y getLoginCommand(commandLine); @@ -251,11 +205,20 @@ public class MSVSSHISTORY extends MSVSS { /** * Set the output file name for SourceSafe output */ - public void setOutputfilename(String outfile) { - if ( outfile.equals("") || outfile == null ) { + public void setOutput(File outfile) { + if ( outfile == null ) { m_OutputFileName = null; } else { - m_OutputFileName = outfile; + m_OutputFileName = outfile.getAbsolutePath(); + } + } + + /** + * Set the Start Date for the Comparison of two versions in SourceSafe History + */ + public void setDateFormat(String dateFormat) { + if ( !(dateFormat.equals("") || dateFormat == null) ) { + m_DateFormat = new SimpleDateFormat(dateFormat); } } @@ -344,11 +307,10 @@ public class MSVSSHISTORY extends MSVSS { String toDate = null; Date currdate = new Date(); Calendar calend= new GregorianCalendar(); - DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT); - currdate = df.parse(fromDate); + currdate = m_DateFormat.parse(fromDate); calend.setTime(currdate); calend.add(Calendar.DATE, numDays); - toDate = df.format(calend.getTime()); + toDate = m_DateFormat.format(calend.getTime()); return toDate; } @@ -385,6 +347,7 @@ public class MSVSSHISTORY extends MSVSS { *
brief: -B Display a brief history. * codediff: -D Display line-by-line file changes. * nofile: -F- Do not display individual file updates in the project history. + * default: No option specified. Display in Source Safe's default format. * */ public void setStyle(BriefCodediffNofile attr) { @@ -393,15 +356,18 @@ public class MSVSSHISTORY extends MSVSS { m_Style = "-B"; } else if (option.equals("codediff")) { m_Style = "-D"; - } else { - // must be "nofile" + } else if (option.equals("default")) { + m_Style = ""; + } else if (option.equals("nofile")) { m_Style = "-F-"; + } else { + throw new BuildException("Style " + attr + " unknown."); } } public static class BriefCodediffNofile extends EnumeratedAttribute { public String[] getValues() { - return new String[] {"brief", "codediff", "nofile"}; + return new String[] {"brief", "codediff", "nofile", "default"}; } }