You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Arnaud Bailly <ab...@norsys.fr> on 2005/10/01 22:30:09 UTC
Changelog svn plugin patch
Hi,
I had some problems with the changelog plugin (svn repository) :
contributor names in the svn are made from X.500 DN from a ssl
certificate which means they can contain spaces and do not follow the
pattern in the plugin.
Here is a small patch that:
- replaces the regexp for authors
- trim the result before addition to ChangelogEntry
- fixes test cases
This patch was produced using svn diff command
src/test/org/apache/maven/svnlib/SvnChangeLogParserTest.java
===================================================================
--- src/test/org/apache/maven/svnlib/SvnChangeLogParserTest.java
(révision 293017)
+++ src/test/org/apache/maven/svnlib/SvnChangeLogParserTest.java (copie
de travail)
@@ -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" +
Index: src/main/org/apache/maven/svnlib/SvnChangeLogParser.java
===================================================================
--- src/main/org/apache/maven/svnlib/SvnChangeLogParser.java (révision
293017)
+++ src/main/org/apache/maven/svnlib/SvnChangeLogParser.java (copie de
travail)
@@ -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;
Index: src/test-resources/svnlib/svnlog.txt
===================================================================
--- src/test-resources/svnlib/svnlog.txt (révision 293017)
+++ src/test-resources/svnlib/svnlog.txt (copie de travail)
@@ -1,5 +1,5 @@
------------------------------------------------------------------------
-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
@@ -7,6 +7,13 @@
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
Changed paths:
M /poolserver/trunk/build.xml
Yours,
--
Arnaud Bailly - Ingénieur de Recherche
NORSYS
1, rue de la Cense des Raines
ZAC du Moulin
59710 ENNEVELIN
Tel : (33) 3 28 76 56 76
Fax : (33) 3 28 76 57 00
Web : http://www.norsys.frIndex:
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: Changelog svn plugin patch
Posted by Arnaud Bailly <ab...@norsys.fr>.
Lukas Theussl wrote:
> Hi Arnaud,
>
> I believe there is a already an issue open that adresses this problem:
> http://jira.codehaus.org/browse/MPCHANGELOG-70
> Please either attach your patch there (it is obviously more complete
> than the one that was submitted already) or open a new issue for it.
>
Done !
--
Arnaud Bailly - Ingénieur de Recherche
NORSYS
1, rue de la Cense des Raines
ZAC du Moulin
59710 ENNEVELIN
Tel : (33) 3 28 76 56 76
Fax : (33) 3 28 76 57 00
Web : http://www.norsys.fr
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: Changelog svn plugin patch
Posted by Lukas Theussl <lt...@apache.org>.
Hi Arnaud,
I believe there is a already an issue open that adresses this problem:
http://jira.codehaus.org/browse/MPCHANGELOG-70
Please either attach your patch there (it is obviously more complete
than the one that was submitted already) or open a new issue for it.
Thanks!
-Lukas
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org