[svn r57474] Fixed bug reported by Martijn Faassen - when the XML output of 'svn st --xml'

didn't contain author information, the code raised an exception.

--HG--
branch : trunk
This commit is contained in:
guido 2008-08-19 21:50:06 +02:00
parent 620805c4d2
commit c32fa7b4f3
2 changed files with 18 additions and 4 deletions

View File

@ -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 @@ class TestWCSvnCommandPath(CommonSvnTests):
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)

View File

@ -684,9 +684,10 @@ class XMLWCStatus(WCStatus):
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: