From c32fa7b4f3bcb07f76a39414f637a99ab7dfa161 Mon Sep 17 00:00:00 2001 From: guido Date: Tue, 19 Aug 2008 21:50:06 +0200 Subject: [PATCH] [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 --- py/path/svn/testing/test_wccommand.py | 15 ++++++++++++++- py/path/svn/wccommand.py | 7 ++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/py/path/svn/testing/test_wccommand.py b/py/path/svn/testing/test_wccommand.py index ec3bd194b..82ee187cc 100644 --- a/py/path/svn/testing/test_wccommand.py +++ b/py/path/svn/testing/test_wccommand.py @@ -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 = '''\ + + + + 2008-08-19T16:50:53.400198Z + + + + ''' + XMLWCStatus.fromstring(xml, self.root) + def test_diff(self): p = self.root / 'anotherfile' out = p.diff(rev=2) diff --git a/py/path/svn/wccommand.py b/py/path/svn/wccommand.py index 88b5b83d0..c0542aa03 100644 --- a/py/path/svn/wccommand.py +++ b/py/path/svn/wccommand.py @@ -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: