[py-svn] r57474 - in py/trunk/py/path/svn: . testing
guido at codespeak.net
guido at codespeak.net
Tue Aug 19 21:50:09 CEST 2008
Author: guido
Date: Tue Aug 19 21:50:06 2008
New Revision: 57474
Modified:
py/trunk/py/path/svn/testing/test_wccommand.py
py/trunk/py/path/svn/wccommand.py
Log:
Fixed bug reported by Martijn Faassen - when the XML output of 'svn st --xml'
didn't contain author information, the code raised an exception.
Modified: py/trunk/py/path/svn/testing/test_wccommand.py
==============================================================================
--- py/trunk/py/path/svn/testing/test_wccommand.py (original)
+++ py/trunk/py/path/svn/testing/test_wccommand.py Tue Aug 19 21:50:06 2008
@@ -1,7 +1,7 @@
import py
import sys
from py.__.path.svn.testing.svntestbase import CommonSvnTests, getrepowc
-from py.__.path.svn.wccommand import InfoSvnWCCommand
+from py.__.path.svn.wccommand import InfoSvnWCCommand, XMLWCStatus
from py.__.path.svn.wccommand import parse_wcinfotime
from py.__.path.svn import svncommon
from py.__.conftest import option
@@ -214,6 +214,19 @@
assert 'deletefile' not in s.unchanged
assert [x.basename for x in s.deleted] == ['deletefile']
+ def test_status_noauthor(self):
+ # testing for XML without author - this used to raise an exception
+ xml = '''\
+ <entry path="/tmp/pytest-23/wc">
+ <wc-status item="normal" props="none" revision="0">
+ <commit revision="0">
+ <date>2008-08-19T16:50:53.400198Z</date>
+ </commit>
+ </wc-status>
+ </entry>
+ '''
+ XMLWCStatus.fromstring(xml, self.root)
+
def test_diff(self):
p = self.root / 'anotherfile'
out = p.diff(rev=2)
Modified: py/trunk/py/path/svn/wccommand.py
==============================================================================
--- py/trunk/py/path/svn/wccommand.py (original)
+++ py/trunk/py/path/svn/wccommand.py Tue Aug 19 21:50:06 2008
@@ -684,9 +684,10 @@
if commitel:
modrev = commitel.getAttribute('revision')
author = ''
- for c in commitel.getElementsByTagName('author')[0]\
- .childNodes:
- author += c.nodeValue
+ author_els = commitel.getElementsByTagName('author')
+ if author_els:
+ for c in author_els[0].childNodes:
+ author += c.nodeValue
date = ''
for c in commitel.getElementsByTagName('date')[0]\
.childNodes:
More information about the pytest-commit
mailing list