Author: bodewig
Date: Fri Oct 17 08:49:19 2008
New Revision: 705646

URL: http://svn.apache.org/viewvc?rev=705646&view=rev
Log:
support for CVS tags as start/end in cvcchangelog.  Submitted by Rob van 
Oostrum.  PR 27419.

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/docs/manual/CoreTasks/changelog.html
    
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java
    ant/core/trunk/src/tests/antunit/taskdefs/cvs/cvs.xml
    ant/core/trunk/src/tests/antunit/taskdefs/cvs/repository/CVSROOT/history
    ant/core/trunk/src/tests/antunit/taskdefs/cvs/repository/CVSROOT/val-tags
    ant/core/trunk/src/tests/antunit/taskdefs/cvs/repository/antmodule3/yet 
another test.txt,v

Modified: ant/core/trunk/WHATSNEW
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=705646&r1=705645&r2=705646&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Fri Oct 17 08:49:19 2008
@@ -473,6 +473,10 @@
    work against a remote repository without any working copy.
    Bugzilla Report 27419.
 
+ * start and end tags can now be used instead of dates in
+   <cvschangelog>.
+   Bugzilla Report 27419.
+
 Changes from Ant 1.7.0 TO Ant 1.7.1
 =============================================
 

Modified: ant/core/trunk/docs/manual/CoreTasks/changelog.html
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/docs/manual/CoreTasks/changelog.html?rev=705646&r1=705645&r2=705646&view=diff
==============================================================================
--- ant/core/trunk/docs/manual/CoreTasks/changelog.html (original)
+++ ant/core/trunk/docs/manual/CoreTasks/changelog.html Fri Oct 17 08:49:19 2008
@@ -132,6 +132,23 @@
       false.  <em>Since Ant 1.8.0</em></td>
     <td align="center" valign="top">No</td>
   </tr>
+  <tr>
+    <td valign="top">startTag</td>
+    <td valign="top">The start of a tag range. If endTag is also
+      specified, they must both be on the same branch. If endTag is not
+      specified, the end of the range will be the latest on the same
+      branch on which startTag lives.  <em>Since Ant 1.8.0</em></td>
+    <td align="center" valign="top">No</td>
+  </tr>
+  <tr>
+    <td valign="top">endTag</td>
+    <td valign="top">The end of a tag range. If startTag is also
+     specified, they must both be on the same branch. If startTag is
+     not specified, the start of the range will be the top of the
+     branch on which endTag lives.</td>  included in the report.
+    <em>Since Ant 1.8.0</em></td>
+    <td align="center" valign="top">No</td>
+  </tr>
 </table>
 
 <h3>Parameters specified as nested elements</h3>

Modified: 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java?rev=705646&r1=705645&r2=705646&view=diff
==============================================================================
--- 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java 
(original)
+++ 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java 
Fri Oct 17 08:49:19 2008
@@ -98,6 +98,11 @@
     /** Determines whether log (false) or rlog (true) is used */
     private boolean remote = false;
 
+    /** Start tag when doing tag ranges. */
+    private String startTag;
+
+    /** End tag when doing tag ranges. */
+    private String endTag;
 
     /**
      * Filesets containing list of files against which the cvs log will be
@@ -192,6 +197,25 @@
     }
 
     /**
+     * Set the tag at which the changelog should start.
+     *
+     * @param start The date at which the changelog should start.
+     */
+    public void setStartTag(final String start) {
+        this.startTag = start;
+    }
+
+
+    /**
+     * Set the tag at which the changelog should stop.
+     *
+     * @param end The date at which the changelog should stop.
+     */
+    public void setEndTag(final String end) {
+        this.endTag = end;
+    }
+
+    /**
      * Adds a set of files about which cvs logs will be generated.
      *
      * @param fileSet a set of files about which cvs logs will be generated.
@@ -250,7 +274,12 @@
                 // parse.
                 addCommandArgument("-N");
             }
-            if (null != startDate) {
+            if (null != startTag || null != endTag) {
+                // man, do I get spoiled by C#'s ?? operator
+                String startValue = startTag == null ? "" : startTag;
+                String endValue = endTag == null ? "" : endTag;
+                addCommandArgument("-r" + startValue + "::" + endValue);
+            } else if (null != startDate) {
                 final SimpleDateFormat outputDate =
                     new SimpleDateFormat("yyyy-MM-dd");
 
@@ -336,6 +365,12 @@
 
             throw new BuildException(message);
         }
+        if ((null != startTag || null != endTag)
+            && (null != startDate || null != endDate)) {
+            final String message = "Specify either a tag or date range,"
+                + " not both";
+            throw new BuildException(message);
+        }
     }
 
     /**

Modified: ant/core/trunk/src/tests/antunit/taskdefs/cvs/cvs.xml
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/cvs/cvs.xml?rev=705646&r1=705645&r2=705646&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/cvs/cvs.xml (original)
+++ ant/core/trunk/src/tests/antunit/taskdefs/cvs/cvs.xml Fri Oct 17 08:49:19 
2008
@@ -60,6 +60,75 @@
                                value="[yet another test.txt]"/>
   </target>
 
+  <target name="xtestRemoteChangelogStartTag">
+    <mkdir dir="${output}"/>
+    <cvschangelog cvsroot="${cvsroot}"
+                  remote="true" startTag="testtag1"
+                  destfile="${output}/report.xml">
+      <module name="antmodule3"/>
+    </cvschangelog>
+    <au:assertFileExists file="${output}/report.xml"/>
+    <au:assertResourceContains resource="${output}/report.xml"
+                               value="[yet another test.txt]"/>
+  </target>
+
+  <target name="testRemoteChangelogEndTag">
+    <mkdir dir="${output}"/>
+    <cvschangelog cvsroot="${cvsroot}"
+                  remote="true" endTag="testtag2"
+                  destfile="${output}/report.xml">
+      <module name="antmodule3"/>
+    </cvschangelog>
+    <au:assertFileExists file="${output}/report.xml"/>
+    <au:assertResourceContains resource="${output}/report.xml"
+                               value="[yet another test.txt]"/>
+  </target>
+
+  <target name="testRemoteChangelogWithTags">
+    <mkdir dir="${output}"/>
+    <cvschangelog cvsroot="${cvsroot}"
+                  remote="true" endTag="testtag2" startTag="testtag1"
+                  destfile="${output}/report.xml">
+      <module name="antmodule3"/>
+    </cvschangelog>
+    <au:assertFileExists file="${output}/report.xml"/>
+    <au:assertResourceContains resource="${output}/report.xml"
+                               value="[yet another test.txt]"/>
+  </target>
+
+  <target name="xtestLocalChangelogStartTag">
+    <mkdir dir="${output}"/>
+    <cvs cvsroot="${cvsroot}" package="antmodule3" dest="${output}"/>
+    <cvschangelog dir="${output}/antmodule3"
+                  remote="false" startTag="testtag1"
+                  destfile="${output}/report.xml"/>
+    <au:assertFileExists file="${output}/report.xml"/>
+    <au:assertResourceContains resource="${output}/report.xml"
+                               value="[yet another test.txt]"/>
+  </target>
+
+  <target name="testLocalChangelogEndTag">
+    <mkdir dir="${output}"/>
+    <cvs cvsroot="${cvsroot}" package="antmodule3" dest="${output}"/>
+    <cvschangelog dir="${output}/antmodule3"
+                  remote="false" endTag="testtag2"
+                  destfile="${output}/report.xml"/>
+    <au:assertFileExists file="${output}/report.xml"/>
+    <au:assertResourceContains resource="${output}/report.xml"
+                               value="[yet another test.txt]"/>
+  </target>
+
+  <target name="testLocalChangelogWithTags">
+    <mkdir dir="${output}"/>
+    <cvs cvsroot="${cvsroot}" package="antmodule3" dest="${output}"/>
+    <cvschangelog dir="${output}/antmodule3"
+                  remote="false" endTag="testtag2" startTag="testtag1"
+                  destfile="${output}/report.xml"/>
+    <au:assertFileExists file="${output}/report.xml"/>
+    <au:assertResourceContains resource="${output}/report.xml"
+                               value="[yet another test.txt]"/>
+  </target>
+
   <target name="testCvsWithSpaceInModule">
     <mkdir dir="${output}"/>
     <cvs cvsroot="${cvsroot}" dest="${output}">

Modified: 
ant/core/trunk/src/tests/antunit/taskdefs/cvs/repository/CVSROOT/history
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/cvs/repository/CVSROOT/history?rev=705646&r1=705645&r2=705646&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/cvs/repository/CVSROOT/history 
(original)
+++ ant/core/trunk/src/tests/antunit/taskdefs/cvs/repository/CVSROOT/history 
Fri Oct 17 08:49:19 2008
@@ -28,3 +28,27 @@
 O48f8a766|stefan|/tmp/testoutput/*0|antmodule1||antmodule1
 O48f8abf0|stefan|/tmp/testoutput/*0|ant module 2||ant module 2
 O48f8abf2|stefan|/tmp/testoutput/*0|antmodule1||antmodule1
+O48f8ad8b|stefan|~/ASF/ant/ant-HEAD/*0|antmodule3||antmodule3
+M48f8add7|stefan|~/ASF/ant/ant-HEAD/*0|antmodule3|1.2|yet another test.txt
+O48f8ae09|stefan|/tmp/testoutput/*0|ant module 2||ant module 2
+O48f8ae0a|stefan|/tmp/testoutput/*0|antmodule1||antmodule1
+O48f8b07c|stefan|/tmp/testoutput/*0|antmodule3||antmodule3
+O48f8b07d|stefan|/tmp/testoutput/*0|antmodule3||antmodule3
+O48f8b07e|stefan|/tmp/testoutput/*0|antmodule1||antmodule1
+O48f8b07f|stefan|/tmp/testoutput/*0|antmodule3||antmodule3
+O48f8b082|stefan|/tmp/testoutput/*0|ant module 2||ant module 2
+O48f8b141|stefan|/tmp/testoutput/*0|antmodule3||antmodule3
+O48f8b14c|stefan|/tmp/testoutput/*0|antmodule3||antmodule3
+O48f8b1c3|stefan|/tmp/testoutput/*0|antmodule3||antmodule3
+O48f8b1cd|stefan|/tmp/testoutput/*0|antmodule3||antmodule3
+O48f8b20c|stefan|/tmp/testoutput/*0|antmodule3||antmodule3
+O48f8b217|stefan|/tmp/testoutput/*0|antmodule3||antmodule3
+O48f8b301|stefan|/tmp/testoutput/*0|antmodule3||antmodule3
+O48f8b302|stefan|/tmp/testoutput/*0|antmodule1||antmodule1
+O48f8b303|stefan|/tmp/testoutput/*0|antmodule3||antmodule3
+O48f8b307|stefan|/tmp/testoutput/*0|ant module 2||ant module 2
+O48f8b308|stefan|/tmp/testoutput/*0|antmodule3||antmodule3
+O48f8b328|stefan|/tmp/testoutput/*0|antmodule3||antmodule3
+O48f8b329|stefan|/tmp/testoutput/*0|antmodule1||antmodule1
+O48f8b32b|stefan|/tmp/testoutput/*0|ant module 2||ant module 2
+O48f8b32c|stefan|/tmp/testoutput/*0|antmodule3||antmodule3

Modified: 
ant/core/trunk/src/tests/antunit/taskdefs/cvs/repository/CVSROOT/val-tags
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/cvs/repository/CVSROOT/val-tags?rev=705646&r1=705645&r2=705646&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/cvs/repository/CVSROOT/val-tags 
(original)
+++ ant/core/trunk/src/tests/antunit/taskdefs/cvs/repository/CVSROOT/val-tags 
Fri Oct 17 08:49:19 2008
@@ -0,0 +1,2 @@
+testtag1 y
+testtag2 y

Modified: 
ant/core/trunk/src/tests/antunit/taskdefs/cvs/repository/antmodule3/yet another 
test.txt,v
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/cvs/repository/antmodule3/yet%20another%20test.txt%2Cv?rev=705646&r1=705645&r2=705646&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/cvs/repository/antmodule3/yet 
another test.txt,v (original)
+++ ant/core/trunk/src/tests/antunit/taskdefs/cvs/repository/antmodule3/yet 
another test.txt,v Fri Oct 17 08:49:19 2008
@@ -1,35 +1,54 @@
-head     1.1;
-branch   1.1.1;
-access   ;
-symbols  start:1.1.1.1 ant:1.1.1;
-locks    ; strict;
-comment  @# @;
-
+head   1.2;
+access;
+symbols
+       testtag2:1.2
+       testtag1:1.1.1.1
+       start:1.1.1.1
+       ant:1.1.1;
+locks; strict;
+comment        @# @;
+
+
+1.2
+date   2008.10.17.15.23.03;    author stefan;  state Exp;
+branches;
+next   1.1;
+commitid       7ddc48f8add74567;
 
 1.1
-date     2008.10.16.14.51.11;  author stefan;  state Exp;
-branches 1.1.1.1;
-next     ;
-commitid        7f8d48f754df4567;
+date   2008.10.16.14.51.11;    author stefan;  state Exp;
+branches
+       1.1.1.1;
+next   ;
+commitid       7f8d48f754df4567;
 
 1.1.1.1
-date     2008.10.16.14.51.11;  author stefan;  state Exp;
-branches ;
-next     ;
-commitid        7f8d48f754df4567;
+date   2008.10.16.14.51.11;    author stefan;  state Exp;
+branches;
+next   ;
+commitid       7f8d48f754df4567;
 
 
 desc
 @@
 
 
+1.2
+log
[EMAIL PROTECTED] weather report
+@
+text
[EMAIL PROTECTED] and cloudy.
+a bit brighter today.
+@
+
 
 1.1
 log
 @Initial revision
 @
 text
[EMAIL PROTECTED] and cloudy.
[EMAIL PROTECTED] 1
 @
 
 


Reply via email to