[Zope3-checkins] SVN: Zope3/trunk/src/z3checkins/ Added some tweaks
so that z3checkins can cleanly handle the somewhat
Gintautas Miliauskas
gintas at pov.lt
Wed May 26 09:43:45 EDT 2004
Log message for revision 25005:
Added some tweaks so that z3checkins can cleanly handle the somewhat
non-standard Zope 3 checkin mailing list messages. Added a test case
to test these tweaks. (Syntax highlighting is not tested, but I'm too
lazy.)
-=-
Modified: Zope3/trunk/src/z3checkins/message.py
===================================================================
--- Zope3/trunk/src/z3checkins/message.py 2004-05-26 13:34:21 UTC (rev 25004)
+++ Zope3/trunk/src/z3checkins/message.py 2004-05-26 13:43:45 UTC (rev 25005)
@@ -235,12 +235,22 @@
return None
if "CVS:" in subject:
+ # [foo-bar] CVS: foobaz/bar - baz.py:1.5
parts = subject.split("CVS: ", 1)
if len(parts) < 2:
return None
subject = parts[1]
directory = subject.split(' - ')[0]
+ elif "SVN:" in subject:
+ # XXX Format specific to the Zope3 mailing list
+ # [foo-bar] SVN: foobaz/boo/bar.py log message
+ parts = subject.split("SVN: ", 1)
+ if len(parts) < 2:
+ return None
+ subject = parts[1]
+ directory = subject.split(" ", 1)[0]
elif "rev " in subject:
+ # [foo-bar] rev 42 - trunk/foofoofoo
parts = subject.split(' - ')
if len(parts) < 2:
return None
@@ -263,6 +273,7 @@
for line in lines:
if in_log_msg:
if (line.startswith('=== ')
+ or line.startswith('-=-') # XXX Zope3 ML specific
or line.startswith("Added:")
or line.startswith("Modified:")
or line.startswith("Removed:")
@@ -274,7 +285,7 @@
else:
log_message.append(line)
else:
- if (line.lower().startswith('log message:') or
+ if (line.lower().startswith('log message') or
line.startswith("Log:")):
in_log_msg = True
elif line.startswith(' Tag: '):
@@ -618,6 +629,12 @@
log_idx = text.find('\nLog:\n')
if log_idx != -1:
log_idx += len('\nLog:\n')
+ else:
+ log_idx = text.find('Log message') # XXX Zope3 checkin-specific
+ if log_idx != -1:
+ log_idx = text.find('\n', log_idx) + 1
+ # XXX This is yucky...
+ text = text.replace('\n-=-\n', '')
if log_idx == -1:
return '<pre>%s</pre>' % text
Added: Zope3/trunk/src/z3checkins/tests/svn_msg4.txt
===================================================================
--- Zope3/trunk/src/z3checkins/tests/svn_msg4.txt 2004-05-26 13:34:21 UTC (rev 25004)
+++ Zope3/trunk/src/z3checkins/tests/svn_msg4.txt 2004-05-26 13:43:45 UTC (rev 25005)
@@ -0,0 +1,33 @@
+Date: Fri, 21 May 2004 21:57:07 -0400
+Message-Id: <200405220157.i4M1v7YW001064 at cvs.zope.org>
+From: Albertas Agejevas <alga at pov.lt>
+To: zope3-checkins at zope.org
+Subject: [Zope3-checkins]
+ SVN: zope/app/traversing/interfaces.py
+
+Log message for revision 24872:
+
+Changed a comment.
+
+-=-
+Modified: Zope3/trunk/src/zope/app/traversing/interfaces.py
+===================================================================
+--- Zope3/trunk/src/zope/app/traversing/interfaces.py 2004-05-22 01:56:54 UTC (rev 24871)
++++ Zope3/trunk/src/zope/app/traversing/interfaces.py 2004-05-22 01:57:03 UTC (rev 24872)
+@@ -33,7 +33,9 @@
+ name, value items. The 'pname' argument has the original name
+ before parameters were removed.
+
+- It is not the respoonsibility of the handler to wrap the return value.
++ It is not the responsibility of the handler to wrap the return value.
++
++ XXX is this "wrap" comment still relevant?
+ """
+
+ class IPhysicallyLocatable(Interface):
+
+
+_______________________________________________
+Zope3-Checkins mailing list
+Zope3-Checkins at zope.org
+http://mail.zope.org/mailman/listinfo/zope3-checkins
Modified: Zope3/trunk/src/z3checkins/tests/test_message.py
===================================================================
--- Zope3/trunk/src/z3checkins/tests/test_message.py 2004-05-26 13:34:21 UTC (rev 25004)
+++ Zope3/trunk/src/z3checkins/tests/test_message.py 2004-05-26 13:43:45 UTC (rev 25005)
@@ -254,7 +254,30 @@
tzinfo=FixedTimezone(3*60)))
self.assertEquals(msg.body, svn_msg3_text.split("\n\n", 1)[1])
+ def test_parser_svnmsg_zope(self):
+ from z3checkins.message import CheckinMessageParser
+ from z3checkins.message import FixedTimezone
+ # XXX The Zope 3 checkin mailing list uses a non-standard format.
+ # This test checks the compatibility hacks planted in the code.
+ # I hope that they will be removed in the future.
+ svn_msg4 = open_test_data("svn_msg4.txt")
+ svn_msg4_text = svn_msg4.read()
+ svn_msg4.seek(0)
+ parser = CheckinMessageParser()
+ msg = parser.parse(svn_msg4)
+ self.assert_(IMessage.providedBy(msg))
+ self.assertEquals(msg.message_id,
+ "200405220157.i4M1v7YW001064 at cvs.zope.org")
+ self.assertEquals(msg.author_name, "Albertas Agejevas")
+ self.assertEquals(msg.author_email, "alga at pov.lt")
+ self.assertEquals(msg.date, datetime(2004, 5, 21, 21, 57, 07,
+ tzinfo=FixedTimezone(-4*60)))
+ self.assertEquals(msg.directory, "zope/app/traversing/interfaces.py")
+ self.assertEquals(msg.branch, None)
+ self.assertEquals(msg.log_message, """Changed a comment.""")
+ self.assertEquals(msg.body, svn_msg4_text.split("\n\n", 1)[1])
+
class MessageStub:
implements(ICheckinMessage, IMessageContained)
More information about the Zope3-Checkins
mailing list