ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/cvslib ChangeLogTask.java
Date Thu, 28 Mar 2002 23:11:57 GMT
donaldp     02/03/28 15:11:57

  Modified:    src/main/org/apache/tools/ant/taskdefs/cvslib
                        ChangeLogTask.java
  Log:
  Add a daysinpast to support the use case of the maven tool
  
  Revision  Changes    Path
  1.2       +21 -1     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java
  
  Index: ChangeLogTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ChangeLogTask.java	28 Mar 2002 22:58:21 -0000	1.1
  +++ ChangeLogTask.java	28 Mar 2002 23:11:57 -0000	1.2
  @@ -60,6 +60,7 @@
   import java.io.OutputStreamWriter;
   import java.io.PrintWriter;
   import java.io.UnsupportedEncodingException;
  +import java.text.SimpleDateFormat;
   import java.util.Date;
   import java.util.Enumeration;
   import java.util.Properties;
  @@ -97,7 +98,7 @@
    *
    * @author <a href="mailto:jeff.martin@synamic.co.uk">Jeff Martin</a>
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.1 $ $Date: 2002/03/28 22:58:21 $
  + * @version $Revision: 1.2 $ $Date: 2002/03/28 23:11:57 $
    * @ant.task name="changelog"
    */
   public class ChangeLogTask
  @@ -180,6 +181,15 @@
       }
   
       /**
  +     * Set the numbers of days worth of log entries to process.
  +     */
  +    public void setDaysinpast( final int days )
  +    {
  +        final long time = System.currentTimeMillis() - (long)days * 24 * 60 * 60 * 1000;
  +        setStart( new Date( time ) );
  +    }
  +
  +    /**
        * Execute task
        */
       public void execute() throws BuildException
  @@ -200,6 +210,16 @@
           final Commandline command = new Commandline();
           command.setExecutable( "cvs" );
           command.createArgument().setValue( "log" );
  +
  +        if( null != m_start )
  +        {
  +            final SimpleDateFormat outputDate =
  +                new SimpleDateFormat( "yyyy-MM-dd" );
  +
  +            // We want something of the form: -d ">=YYYY-MM-dd"
  +            final String dateRange = "-d >=" + outputDate.format( m_start );
  +            command.createArgument().setValue( dateRange );
  +        }
   
           final ChangeLogParser parser = new ChangeLogParser( userList );
           final RedirectingStreamHandler handler =
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message