From ant-dev-return-12411-apmail-jakarta-ant-dev-archive=jakarta.apache.org@jakarta.apache.org Wed Apr 04 06:56:38 2001 Return-Path: Delivered-To: apmail-jakarta-ant-dev-archive@jakarta.apache.org Received: (qmail 54578 invoked by uid 500); 4 Apr 2001 06:56:35 -0000 Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk Reply-To: ant-dev@jakarta.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 54569 invoked by uid 500); 4 Apr 2001 06:56:34 -0000 Delivered-To: apmail-jakarta-ant-cvs@apache.org Date: 4 Apr 2001 06:56:34 -0000 Message-ID: <20010404065634.54565.qmail@apache.org> From: nico@apache.org To: jakarta-ant-cvs@apache.org Subject: cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/vss MSVSSHISTORY.java nico 01/04/03 23:56:34 Modified: docs/manual/OptionalTasks vsshistory.html src/main/org/apache/tools/ant/taskdefs/optional/vss MSVSSHISTORY.java Log: - Removed javadoc explaining attributes of task. This info is already in the vsshistory.html file. I didn't want to duplicate the work. - Renamed task attribute "outputfilename" to "output" to unify the task attribute namespace (i.e., other tasks use "output", why not this one?). Also made sure that the output filename is relative to the project's basedir. - Added task attribute "dateFormat" to allow the format of dates in "toDate" and "fromDate" to be specified. This was necessary for the "numDays" functionality to work properly with my date format. - Added "default" choice to "style" attribute. If an unknown style attribute is provided, a BuildException is thrown. - Fixed examples in the documentation which not included vsspath - Only pass -R once to ss.exe and only if recursive is really specified Submitted by: Twiggs, Glenn Minor changes by me. Revision Changes Path 1.2 +51 -39 jakarta-ant/docs/manual/OptionalTasks/vsshistory.html Index: vsshistory.html =================================================================== RCS file: /home/cvs/jakarta-ant/docs/manual/OptionalTasks/vsshistory.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- vsshistory.html 2001/03/25 19:19:39 1.1 +++ vsshistory.html 2001/04/04 06:56:32 1.2 @@ -12,112 +12,124 @@ Task to perform HISTORY commands to Microsoft Visual Source Safe.

Parameters

- + - + - + - + - - - - - + + + + - + - + + + + + + - + - + - - + + - + - - + + - + - +
Attribute Values Required
login username,password No
vsspath SourceSafe path Yes
ssdirdirectory 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
serverPathdirectory where srssafe.ini resides.No
serverPathdirectory where srssafe.ini resides.No
fromDate Start date for comparison See below
toDate Start date for comparison See below
dateFormatFormat 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
stylebrief or codediff or nofile. The default is brief.brief, codediff, default or nofile. The default is default. No

Specifying the time-frame

There are different ways to specify what time-frame you wish to evaluate:

    -
  • Changes between two dates: Specify both fromDate and toDate
  • -
  • Changes before a date: Specify toDate
  • -
  • Changes after a date: Specify fromDate
  • -
  • Changes X Days before a date: Specify toDate and (negative!) numDays
  • -
  • Changes X Days after a date: Specify fromDate and numDays
  • +
  • Changes between two dates: Specify both fromDate and toDate
  • +
  • Changes before a date: Specify toDate
  • +
  • Changes after a date: Specify fromDate
  • +
  • Changes X Days before a date: Specify toDate and (negative!) numDays
  • +
  • Changes X Days after a date: Specify fromDate and numDays

Examples

-
  -<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 1.2 +31 -65 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSHISTORY.java Index: MSVSSHISTORY.java =================================================================== RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSHISTORY.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MSVSSHISTORY.java 2001/03/25 19:19:38 1.1 +++ MSVSSHISTORY.java 2001/04/04 06:56:34 1.2 @@ -57,74 +57,29 @@ 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: - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
AttributeValuesRequired
loginusername,passwordNo
vsspathSourceSafe pathYes
ssdirdirectory where ss.exe resides. By default the task - * expects it to be in the PATH.No
startdateStart date for comparisonYes
outputfilenameFile to write the diff.Yes
numdaysThe number of days for comparison. The default value is -2 days.No
recursivetrue or falseNo
stylebrief or codediff or nofile. The default is brief.No
* * @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 static final String FLAG_OUTPUT = "-O"; public static final String FLAG_USER = "-U"; - + /** * Executes the task. *

@@ -163,9 +118,6 @@ // -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 @@ } // -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 @@ /** * 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 @@ 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 @@ *

  • 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 @@ 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"}; } }