Author: ltheussl
Date: Mon Oct  3 10:14:54 2005
New Revision: 293395

URL: http://svn.apache.org/viewcvs?rev=293395&view=rev
Log:
MPCHANGELOG-70: Fix regexp's for username with spaces + tests. Thanks to Arnaud 
Bailly.

Modified:
    
maven/maven-1/plugins/trunk/changelog/src/main/org/apache/maven/svnlib/SvnChangeLogParser.java
    maven/maven-1/plugins/trunk/changelog/src/test-resources/svnlib/svnlog.txt
    
maven/maven-1/plugins/trunk/changelog/src/test/org/apache/maven/svnlib/SvnChangeLogParserTest.java
    maven/maven-1/plugins/trunk/changelog/xdocs/changes.xml

Modified: 
maven/maven-1/plugins/trunk/changelog/src/main/org/apache/maven/svnlib/SvnChangeLogParser.java
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/changelog/src/main/org/apache/maven/svnlib/SvnChangeLogParser.java?rev=293395&r1=293394&r2=293395&view=diff
==============================================================================
--- 
maven/maven-1/plugins/trunk/changelog/src/main/org/apache/maven/svnlib/SvnChangeLogParser.java
 (original)
+++ 
maven/maven-1/plugins/trunk/changelog/src/main/org/apache/maven/svnlib/SvnChangeLogParser.java
 Mon Oct  3 10:14:54 2005
@@ -82,7 +82,7 @@
     /** The pattern used to match svn header lines */
     private static final String pattern =
         "^r(\\d+)\\s+\\|\\s+" +          // revision number
-        "(\\(\\S+\\s+\\S+\\)|\\S+)\\s+\\|\\s+" + // author username
+        "([^|]+)\\|\\s+" +               // author username
         "(\\d+-\\d+-\\d+ " +             // date 2002-08-24
         "\\d+:\\d+:\\d+) " +             // time 16:01:00
         "([\\-+])(\\d\\d)(\\d\\d)";      // gmt offset -0400 
@@ -198,7 +198,8 @@
 
         currentRevision = headerRegexp.getParen(1);
         currentLogEntry = new ChangeLogEntry();
-        currentLogEntry.setAuthor(headerRegexp.getParen(2));
+        /* set author to be trimmed author field */
+        currentLogEntry.setAuthor(headerRegexp.getParen(2).trim());
         currentLogEntry.setDate(parseDate());
 
         status = GET_FILE;

Modified: 
maven/maven-1/plugins/trunk/changelog/src/test-resources/svnlib/svnlog.txt
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/changelog/src/test-resources/svnlib/svnlog.txt?rev=293395&r1=293394&r2=293395&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/changelog/src/test-resources/svnlib/svnlog.txt 
(original)
+++ maven/maven-1/plugins/trunk/changelog/src/test-resources/svnlib/svnlog.txt 
Mon Oct  3 10:14:54 2005
@@ -1,10 +1,17 @@
 ------------------------------------------------------------------------
-r15 | kaz | 2002-08-26 14:33:26 -0400 (Mon, 26 Aug 2002) | 3 lines
+r16 | kaz | 2002-08-26 20:33:26 -0400 (Mon, 26 Aug 2002) | 3 lines
 Changed paths:
    M /poolserver/trunk/build.xml
    M /poolserver/trunk/project.properties
 
 Minor formatting changes.
+
+------------------------------------------------------------------------
+r15 | kaz toto | 2002-08-26 10:24:58 -0400 (Mon, 26 Aug 2002) | 3 lines
+Changed paths:
+   M /poolserver/trunk/build.xml
+
+Added white space to test author parsing.
 
 ------------------------------------------------------------------------
 r14 | kaz | 2002-08-26 10:24:58 -0400 (Mon, 26 Aug 2002) | 3 lines

Modified: 
maven/maven-1/plugins/trunk/changelog/src/test/org/apache/maven/svnlib/SvnChangeLogParserTest.java
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/changelog/src/test/org/apache/maven/svnlib/SvnChangeLogParserTest.java?rev=293395&r1=293394&r2=293395&view=diff
==============================================================================
--- 
maven/maven-1/plugins/trunk/changelog/src/test/org/apache/maven/svnlib/SvnChangeLogParserTest.java
 (original)
+++ 
maven/maven-1/plugins/trunk/changelog/src/test/org/apache/maven/svnlib/SvnChangeLogParserTest.java
 Mon Oct  3 10:14:54 2005
@@ -77,18 +77,22 @@
         FileInputStream fis = new FileInputStream(testFile);
         List entries = new ArrayList(parser.parse(fis));
 
-        assertEquals("Wrong number of entries returned", 13, entries.size());
+        assertEquals("Wrong number of entries returned", 14, entries.size());
 
         ChangeLogEntry entry = (ChangeLogEntry) entries.get(0);
         assertEquals("Entry 0 was parsed incorrectly", 
                 "kaz\n" +
-                DATE.parse("Mon Aug 26 14:33:26 EDT 2002") + "\n" +
-                "[/poolserver/trunk/build.xml, 15, " +
-                "/poolserver/trunk/project.properties, 15]\n" +
+                DATE.parse("Mon Aug 26 20:33:26 EDT 2002") + "\n" +
+                "[/poolserver/trunk/build.xml, 16, " +
+                "/poolserver/trunk/project.properties, 16]\n" +
                 "Minor formatting changes.\n\n",
                 entry.toString());
+        /* check author with space was parsed correctly */
+        entry = (ChangeLogEntry) entries.get(1);
+        assertEquals("Entry 0 was parsed incorrectly", 
+                "kaz toto",entry.getAuthor());
 
-        entry = (ChangeLogEntry) entries.get(6);
+        entry = (ChangeLogEntry) entries.get(7);
         assertEquals("Entry 6 was parsed incorrectly", 
                 "(no author)\n" +
                 DATE.parse("Fri Aug 23 11:11:52 EDT 2002") + "\n" +
@@ -96,7 +100,7 @@
                 "Testing script out again ...\n\n",
                 entry.toString());
 
-        entry = (ChangeLogEntry) entries.get(8);
+        entry = (ChangeLogEntry) entries.get(9);
         assertEquals("Entry 8 was parsed incorrectly",
                 "pete\n" +
                 DATE.parse("Fri Aug 23 11:03:39 EDT 2002") + "\n" +
@@ -105,7 +109,7 @@
                 "subversion).\n\n",
                 entry.toString());
 
-        entry = (ChangeLogEntry) entries.get(12);
+        entry = (ChangeLogEntry) entries.get(13);
         assertEquals("Entry 12 was parsed incorrectly",
                 "DOMAIN\\user\n" +
                 DATE.parse("Wed Aug 21 00:20:25 EDT 2002") + "\n" +

Modified: maven/maven-1/plugins/trunk/changelog/xdocs/changes.xml
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/changelog/xdocs/changes.xml?rev=293395&r1=293394&r2=293395&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/changelog/xdocs/changes.xml (original)
+++ maven/maven-1/plugins/trunk/changelog/xdocs/changes.xml Mon Oct  3 10:14:54 
2005
@@ -24,6 +24,9 @@
     <author email="[EMAIL PROTECTED]">Emmanuel Venisse</author>
   </properties>
   <body>
+    <release version="1.9-SNAPSHOT" date="in SVN">
+      <action dev="ltheussl" type="fix" issue="MPCHANGELOG-70" due-to="Arnaud 
Bailly">Incorrect parsing of SVN log files when username contains 
spaces.</action>
+    </release>
     <release version="1.8.2" date="2005-06-15">
       <action dev="brett" type="fix" issue="MPCHANGELOG-66">Avoid 
NullPointerException when no type is given</action>
       <action dev="brett" type="fix" issue="MPCHANGELOG-65" due-to="Fuad 
Efendi">Corrected parsing of VSS results</action>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to