From 28cd8dae049016ba787dd53f8b8485a8e1596ad5 Mon Sep 17 00:00:00 2001 From: dlr Date: Sat, 22 Nov 2003 22:52:13 +0000 Subject: [PATCH] Some updates for Subversion 0.33.0 to implement date operations (they work over ra_dav these days), and to update the parsing of the ouput from `svn log`. * changelog/xdocs/properties.xml maven.changelog.range: Removed now unnecessary disclaimer about SVN and its ra_dav repository access module from the docs. * changelog/src/main/org/apache/maven/svnlib/SvnChangeLogGenerator.java getScmDateArgument(Date, Date): Updated the JavaDoc and implementation to the correct date argument formatting for SVN. * changelog/src/main/org/apache/maven/svnlib/SvnChangeLogParser.java pattern: Updated regex for new `svn log` output format. parse(InputStream): Tweaked inline comment. * changelog/src/test/org/apache/maven/svnlib/SvnChangeLogParserTest.java Header JavaDoc tweak. * changelog/src/test-resources/svnlib/svnlog.txt Updated to match the current log output format. git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114396 13f79535-47bb-0310-9956-ffa450edef68 --- .../maven/svnlib/SvnChangeLogGenerator.java | 12 ++++++---- .../maven/svnlib/SvnChangeLogParser.java | 7 +++--- .../src/test-resources/svnlib/svnlog.txt | 24 +++++++++---------- .../maven/svnlib/SvnChangeLogParserTest.java | 5 ++-- changelog/xdocs/properties.xml | 7 +----- 5 files changed, 27 insertions(+), 28 deletions(-) diff --git a/changelog/src/main/org/apache/maven/svnlib/SvnChangeLogGenerator.java b/changelog/src/main/org/apache/maven/svnlib/SvnChangeLogGenerator.java index 0fa6bbc9..37eeb6a3 100644 --- a/changelog/src/main/org/apache/maven/svnlib/SvnChangeLogGenerator.java +++ b/changelog/src/main/org/apache/maven/svnlib/SvnChangeLogGenerator.java @@ -78,8 +78,9 @@ import org.apache.tools.ant.types.Commandline; * @author Stefan Bodewig * @author Peter Donald * @author Pete Kazmier + * @author Daniel Rall * @version - * $Id: SvnChangeLogGenerator.java,v 1.2 2003/10/25 17:50:37 epugh Exp $ + * $Id: SvnChangeLogGenerator.java,v 1.3 2003/11/22 22:52:13 dlr Exp $ */ class SvnChangeLogGenerator extends AbstractChangeLogGenerator { @@ -110,8 +111,8 @@ class SvnChangeLogGenerator extends AbstractChangeLogGenerator /** * Construct the svn command-line argument that is used to specify - * the appropriate date range. This date option takes the format of - * "-D start:end" in the case of Subversion. + * the appropriate date range. This date option takes the format + * of -r{start}:{end} in the case of Subversion. * * @param before The starting point. * @param to The ending point. @@ -121,8 +122,9 @@ class SvnChangeLogGenerator extends AbstractChangeLogGenerator protected String getScmDateArgument(Date before, Date to) { SimpleDateFormat outputDate = new SimpleDateFormat("yyyy-MM-dd"); - // Specify to:before as that will sort the log entries for us - return "-D " + outputDate.format(to) + ":" + outputDate.format(before); + // Tell SVN to sort log entries from newest to oldest. + return "-r{" + outputDate.format(to) + "}:{" + + outputDate.format(before) + '}'; } /** diff --git a/changelog/src/main/org/apache/maven/svnlib/SvnChangeLogParser.java b/changelog/src/main/org/apache/maven/svnlib/SvnChangeLogParser.java index fd44e41a..dd93b57c 100644 --- a/changelog/src/main/org/apache/maven/svnlib/SvnChangeLogParser.java +++ b/changelog/src/main/org/apache/maven/svnlib/SvnChangeLogParser.java @@ -82,7 +82,8 @@ import org.apache.regexp.RESyntaxException; * * @author dIon Gillard * @author Pete Kazmier - * @version $Id: SvnChangeLogParser.java,v 1.2 2003/10/25 17:50:37 epugh Exp $ + * @author Daniel Rall + * @version $Id: SvnChangeLogParser.java,v 1.3 2003/11/22 22:52:13 dlr Exp $ */ class SvnChangeLogParser implements ChangeLogParser { @@ -119,7 +120,7 @@ class SvnChangeLogParser implements ChangeLogParser /** The pattern used to match svn header lines */ private static final String pattern = - "^rev (\\d+):\\s+" + // revision number + "^r(\\d+)\\s+\\|\\s+" + // revision number "(\\w+)\\s+\\|\\s+" + // author username "(\\d+-\\d+-\\d+ " + // date 2002-08-24 "\\d+:\\d+:\\d+) " + // time 16:01:00 @@ -193,7 +194,7 @@ class SvnChangeLogParser implements ChangeLogParser BufferedReader stream = new BufferedReader( new InputStreamReader(anInputStream)); - // current state transitions in the state machine - starts with Get Header + // Current state transitions in the parser's state machine: // Get Header -> Get File // Get File -> Get Comment or Get (another) File // Get Comment -> Get (another) Comment diff --git a/changelog/src/test-resources/svnlib/svnlog.txt b/changelog/src/test-resources/svnlib/svnlog.txt index add0caf0..8a42f1fd 100644 --- a/changelog/src/test-resources/svnlib/svnlog.txt +++ b/changelog/src/test-resources/svnlib/svnlog.txt @@ -1,5 +1,5 @@ ------------------------------------------------------------------------ -rev 15: kaz | 2002-08-26 14:33:26 -0400 (Mon, 26 Aug 2002) | 3 lines +r15 | kaz | 2002-08-26 14:33:26 -0400 (Mon, 26 Aug 2002) | 3 lines Changed paths: M /poolserver/trunk/build.xml M /poolserver/trunk/project.properties @@ -7,56 +7,56 @@ Changed paths: Minor formatting changes. ------------------------------------------------------------------------ -rev 14: kaz | 2002-08-26 10:24:58 -0400 (Mon, 26 Aug 2002) | 3 lines +r14 | kaz | 2002-08-26 10:24:58 -0400 (Mon, 26 Aug 2002) | 3 lines Changed paths: M /poolserver/trunk/build.xml Cleaned up some whitespace. ------------------------------------------------------------------------ -rev 13: kaz | 2002-08-24 12:56:37 -0400 (Sat, 24 Aug 2002) | 3 lines +r13 | kaz | 2002-08-24 12:56:37 -0400 (Sat, 24 Aug 2002) | 3 lines Changed paths: M /poolserver/trunk/src/java Added an svn:ignore property to ignore the 'tags' file. ------------------------------------------------------------------------ -rev 12: kaz | 2002-08-24 12:31:41 -0400 (Sat, 24 Aug 2002) | 3 lines +r12 | kaz | 2002-08-24 12:31:41 -0400 (Sat, 24 Aug 2002) | 3 lines Changed paths: D /poolserver/trunk/src/java/net/ibasis/poolserver/impl/snmp/.SnmpPhysicalGateway.java.swp Ditching a vim swap file. ------------------------------------------------------------------------ -rev 11: kaz | 2002-08-24 00:20:25 -0400 (Sat, 24 Aug 2002) | 3 lines +r11 | kaz | 2002-08-24 00:20:25 -0400 (Sat, 24 Aug 2002) | 3 lines Changed paths: M /poolserver/trunk/src/java/net/ibasis/poolserver/impl/snmp/SnmpPhysicalGateway.java Did some basic refactoring and just preparing to go-time. ------------------------------------------------------------------------ -rev 10: kaz | 2002-08-24 00:19:39 -0400 (Sat, 24 Aug 2002) | 3 lines +r10 | kaz | 2002-08-24 00:19:39 -0400 (Sat, 24 Aug 2002) | 3 lines Changed paths: M /poolserver/trunk/build.xml Added a ctags target in the event I have to use vim. ------------------------------------------------------------------------ -rev 9: kaz | 2002-08-23 11:11:52 -0400 (Fri, 23 Aug 2002) | 3 lines +r9 | kaz | 2002-08-23 11:11:52 -0400 (Fri, 23 Aug 2002) | 3 lines Changed paths: M /poolserver/trunk/build.xml Testing script out again ... ------------------------------------------------------------------------ -rev 8: kaz | 2002-08-23 11:07:46 -0400 (Fri, 23 Aug 2002) | 3 lines +r8 | kaz | 2002-08-23 11:07:46 -0400 (Fri, 23 Aug 2002) | 3 lines Changed paths: M /poolserver/trunk/build.xml Testing svn commit-email script ... ------------------------------------------------------------------------ -rev 7: pete | 2002-08-23 11:03:39 -0400 (Fri, 23 Aug 2002) | 4 lines +r7 | pete | 2002-08-23 11:03:39 -0400 (Fri, 23 Aug 2002) | 4 lines Changed paths: M /poolserver/trunk/build.xml @@ -64,14 +64,14 @@ Reformatted the indentation (really just an excuse to test out subversion). ------------------------------------------------------------------------ -rev 6: kaz | 2002-08-23 10:36:23 -0400 (Fri, 23 Aug 2002) | 3 lines +r6 | kaz | 2002-08-23 10:36:23 -0400 (Fri, 23 Aug 2002) | 3 lines Changed paths: M /poolserver/trunk/resources/WEB-INF/lib/xerces-1.4.4.jar Replacing the xerces library as it seems to be corrupted. ------------------------------------------------------------------------ -rev 5: kaz | 2002-08-22 11:28:22 -0400 (Thu, 22 Aug 2002) | 3 lines +r5 | kaz | 2002-08-22 11:28:22 -0400 (Thu, 22 Aug 2002) | 3 lines Changed paths: A /poolserver/trunk/build.xml A /poolserver/trunk/poolserver.zargo @@ -204,7 +204,7 @@ Changed paths: Initial import of sources. ------------------------------------------------------------------------ -rev 2: kaz | 2002-08-22 11:25:16 -0400 (Thu, 22 Aug 2002) | 1 line +r2 | kaz | 2002-08-22 11:25:16 -0400 (Thu, 22 Aug 2002) | 1 line Changed paths: A /poolserver/trunk diff --git a/changelog/src/test/org/apache/maven/svnlib/SvnChangeLogParserTest.java b/changelog/src/test/org/apache/maven/svnlib/SvnChangeLogParserTest.java index 171d60b6..ddb15ff7 100644 --- a/changelog/src/test/org/apache/maven/svnlib/SvnChangeLogParserTest.java +++ b/changelog/src/test/org/apache/maven/svnlib/SvnChangeLogParserTest.java @@ -64,9 +64,10 @@ import junit.framework.TestCase; import org.apache.maven.changelog.ChangeLogEntry; /** - * Test cases for {@link SvnChangeLogParser} + * Test cases for {@link SvnChangeLogParser}. + * * @author Pete Kazmier - * @version $Id: SvnChangeLogParserTest.java,v 1.2 2003/10/25 17:50:37 epugh Exp $ + * @version $Id: SvnChangeLogParserTest.java,v 1.3 2003/11/22 22:52:13 dlr Exp $ */ public class SvnChangeLogParserTest extends TestCase { diff --git a/changelog/xdocs/properties.xml b/changelog/xdocs/properties.xml index 647e03ef..f4ff23ec 100644 --- a/changelog/xdocs/properties.xml +++ b/changelog/xdocs/properties.xml @@ -20,12 +20,7 @@ Specifies the range to use when generating the change log. This is used by the "changelog" goal. The default value is - 5 days. Note: when using the Subversion - changelog factory, you must set this property to an - empty value because the Subversion ra_dav module (used to - access DAV repositories) does not support date operations - yet. If you are using a local repository (ra_local), then - this does not apply to you. + 5 days.