Hi there,

I just tried the trunk of Py with my project which makes very heavy use of the py.path SVN facilities, and I get a lot of errors that look like this:

File "/home/faassen/buildout/z3c.vcsync/py/py/path/svn/wccommand.py", line
 270, in status
        rootstatus = XMLWCStatus(self).fromstring(out, self)
File "/home/faassen/buildout/z3c.vcsync/py/py/path/svn/wccommand.py", line
 687, in fromstring
        for c in commitel.getElementsByTagName('author')[0]\
    IndexError: list index out of range

It looks to me like a certain assumption about the format of the XML returned is incorrect.

The SVN version on my system is svn, version 1.4.3 (r23084)

When debugging it, the XML that trips up the code looks like this:

<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>

It looks like this means there is not always an 'author' entry in this XML structure.

Attached is a patch to wccommand.py that makes the problem go away (and indeed seems to fix the original problem I was looking into - the trunk has support for the svn status flag R, something that py 0.9.1 didn't have).

I realize this patch isn't enough but needs a test as well. I could find no obvious way (in the form of documentation, say, the README.txt, or the website) on how to actually run the tests of the trunk. :) It's quite possible I missed something.

Is py 0.9.2 to be based off the work on the trunk?

Regards,

Martijn

Index: py/path/svn/wccommand.py
===================================================================
--- py/path/svn/wccommand.py	(revision 57467)
+++ py/path/svn/wccommand.py	(working copy)
@@ -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:
_______________________________________________
py-dev mailing list
py-dev@codespeak.net
http://codespeak.net/mailman/listinfo/py-dev

Reply via email to