ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/vss MSVSSHISTORY.java
Date Wed, 04 Apr 2001 06:56:34 GMT
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 <Glenn_Twiggs@bmc.com>
  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.
   <h3>Parameters</h3>
   <table border="1" cellpadding="2" cellspacing="0">
  -  <tr>
  +  <tr> 
       <th>Attribute</th>
       <th>Values</th>
       <th>Required</th>
     </tr>
  -  <tr>
  +  <tr> 
       <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>ssdir</td>
  -    <td>directory where <code>ss.exe</code> resides. By default the task
  +    <td>directory where <code>ss.exe</code> resides. By default the task

           expects it to be in the PATH.</td>
       <td>No</td>
     </tr>
  -  <tr>
  -     <td>serverPath</td>
  -     <td>directory where <code>srssafe.ini</code> resides.</td>
  -     <td>No</td>
  +  <tr> 
  +    <td>serverPath</td>
  +    <td>directory where <code>srssafe.ini</code> resides.</td>
  +    <td>No</td>
     </tr>
  -  <tr>
  +  <tr> 
       <td>fromDate</td>
       <td>Start date for comparison</td>
       <td>See below</td>
     </tr>
  -  <tr>
  +  <tr> 
       <td>toDate</td>
       <td>Start date for comparison</td>
       <td>See below</td>
     </tr>
     <tr>
  +    <td>dateFormat</td>
  +    <td>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.</td>
  +    <td>No</td>
  +  </tr>
  +  <tr> 
       <td>fromLabel</td>
       <td>Start label for comparison</td>
       <td>No</td>
     </tr>
  -  <tr>
  +  <tr> 
       <td>toLabel</td>
       <td>Start label for comparison</td>
       <td>No</td>
     </tr>
  -  <tr>
  +  <tr> 
       <td>numdays</td>
       <td>The number of days for comparison.</td>
       <td>See below</td>
     </tr>
  -  <tr>
  -    <td>outputfilename</td>
  +  <tr> 
  +    <td>output</td>
       <td>File to write the diff.</td>
       <td>No</td>
     </tr>
  -  <tr>
  +  <tr> 
       <td>recursive</td>
       <td>true or false</td>
       <td>No</td>
  -  <tr>
  -  <tr>
  +  <tr> 
  +  <tr> 
       <td>style</td>
  -    <td>brief or codediff or nofile. The default is brief.</td>
  +    <td>brief, codediff, default or nofile. The default is default.</td>
       <td>No</td>
  -  <tr>
  +  <tr> 
   </table>
   
   <h4>Specifying the time-frame</h4>
   <p>There are different ways to specify what time-frame you wish to evaluate:</p>
   <ul>
  -	<li>Changes between two dates: Specify both <code>fromDate</code> and
<code>toDate</code> </li>
  -	<li>Changes before a date: Specify <code>toDate</code></li>
  -	<li>Changes after a date: Specify <code>fromDate</code></li>
  -	<li>Changes X Days before a date: Specify <code>toDate</code> and (negative!)
<code>numDays</code></li>
  -	<li>Changes X Days after a date: Specify <code>fromDate</code> and <code>numDays</code></li>
  +  <li>Changes between two dates: Specify both <code>fromDate</code> and
<code>toDate</code> </li>
  +  <li>Changes before a date: Specify <code>toDate</code></li>
  +  <li>Changes after a date: Specify <code>fromDate</code></li>
  +  <li>Changes X Days before a date: Specify <code>toDate</code> and (negative!)
<code>numDays</code></li>
  +  <li>Changes X Days after a date: Specify <code>fromDate</code> and
<code>numDays</code></li>
   </ul>
   
   
   <h3>Examples</h3>
   <blockquote>
  -<pre>
  -&lt;vsshistory recursive=&quot;true&quot; 
  -        fromLabel=&quot;Release1&quot;
  -        toLabel=&quot;Release2&quot;/&gt;
  +  <pre>
  +&lt;vsshistory vsspath=&quot;/myProject&quot; recursive=&quot;true&quot;

  +            fromLabel=&quot;Release1&quot;
  +            toLabel=&quot;Release2&quot;/&gt;
   </pre>
   </blockquote>
   <p>Shows all changes between &quot;Release1&quot; and &quot;Release2&quot;.</p>
   
   <blockquote>
  -<pre>
  -&lt;vsshistory recursive=&quot;true&quot; 
  -        fromDate=&quot;01.01.2001&quot;
  -        toDate=&quot;31.03.2001&quot;/&gt;
  +  <pre>
  +&lt;vsshistory vsspath=&quot;/myProject&quot; recursive=&quot;true&quot;

  +            fromDate=&quot;01.01.2001&quot;
  +            toDate=&quot;31.03.2001&quot;/&gt;
   </pre>
   </blockquote>
   <p>Shows all changes between January 1st 2001 and March 31st 2001 (in Germany, date
must be specified according to your locale).</p>
   
  -<blockquote>
  -<pre>
  -&lt;vsshistory recursive=&quot;true&quot; 
  -        numDays="-14"
  -        toDate=&quot;31.01.2001&quot;/&gt;
  +<blockquote> 
  +  <pre>
  +&lt;tstamp&gt;
  +  &lt;format property=&quot;to.tstamp&quot; pattern=&quot;M-d-yy;h:mma&quot;
/&gt;
  +&lt;/tstamp&gt;
  +
  +&lt;vsshistory vsspath=&quot;/myProject&quot; recursive=&quot;true&quot;

  +            numDays="-14"
  +            dateFormat=&quot;M-d-yy;h:mma&quot;
  +            toDate=&quot;${to.tstamp}&quot;/&gt;
   </pre>
   </blockquote>
  -<p>Shows all changes in the 14 days before January 31st 2001 (in Germany, date must
be specified according to your locale).</p>
  +<p>Shows all changes in the 14 days before today.</p>
   
   <hr>
   <p align="center">Copyright &copy; 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.
  - * <p>
  - * The following attributes are interpreted:
  - * <table border="1">
  - *   <tr>
  - *     <th>Attribute</th>
  - *     <th>Values</th>
  - *     <th>Required</th>
  - *   </tr>
  - *   <tr>
  - *      <td>login</td>
  - *      <td>username,password</td>
  - *      <td>No</td>
  - *   </tr>
  - *   <tr>
  - *      <td>vsspath</td>
  - *      <td>SourceSafe path</td>
  - *      <td>Yes</td>
  - *   </tr>
  - *   <tr>
  - *      <td>ssdir</td>
  - *      <td>directory where <code>ss.exe</code> resides. By default the
task
  - *      expects it to be in the PATH.</td>
  - *      <td>No</td>
  - *   </tr>
  - *   <tr>
  - *      <td>startdate</td>
  - *      <td>Start date for comparison</td>
  - *      <td>Yes</td>
  - *   </tr>
  - *   <tr>
  - *      <td>outputfilename</td>
  - *      <td>File to write the diff.</td>
  - *      <td>Yes</td>
  - *   </tr>
  - *   <tr>
  - *      <td>numdays</td>
  - *      <td>The number of days for comparison. The default value is -2 days.</td>
  - *      <td>No</td>
  - *   </tr>
  - *   <tr>
  - *      <td>recursive</td>
  - *      <td>true or false</td>
  - *      <td>No</td>
  - *   <tr>
  - *   <tr>
  - *      <td>style</td>
  - *      <td>brief or codediff or nofile. The default is brief.</td>
  - *      <td>No</td>
  - *   <tr>
  - * </table>
    *
    * @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.
        * <p>
  @@ -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 @@
        * <li>brief:    -B Display a brief history. 
        * <li>codediff: -D Display line-by-line file changes. 
        * <li>nofile:   -F- Do not display individual file updates in the project history.

  +     * <li>default:  No option specified. Display in Source Safe's default format.
        * </ul>
        */
       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"};
          }
      }
   
  
  
  

Mime
View raw message