convert: use raw strings for XML strings
authorGregory Szorc <gregory.szorc@gmail.com>
Wed, 23 Jan 2019 16:21:36 -0800
changeset 41327 1281b2265ff5
parent 41326 7c54357be2ae
child 41328 13ccb03f2145
convert: use raw strings for XML strings Due to the source transformer, we were passing bytes into the XML APIs. This results in not finding elements and doing compares against mismatched types. Use raw string literals so we use str everywhere. Differential Revision: https://phab.mercurial-scm.org/D5664
hgext/convert/subversion.py
--- a/hgext/convert/subversion.py	Wed Jan 23 16:22:54 2019 -0800
+++ b/hgext/convert/subversion.py	Wed Jan 23 16:21:36 2019 -0800
@@ -1183,12 +1183,12 @@
         m = set()
         output = self.run0('ls', recursive=True, xml=True)
         doc = xml.dom.minidom.parseString(output)
-        for e in doc.getElementsByTagName('entry'):
+        for e in doc.getElementsByTagName(r'entry'):
             for n in e.childNodes:
-                if n.nodeType != n.ELEMENT_NODE or n.tagName != 'name':
+                if n.nodeType != n.ELEMENT_NODE or n.tagName != r'name':
                     continue
-                name = ''.join(c.data for c in n.childNodes
-                               if c.nodeType == c.TEXT_NODE)
+                name = r''.join(c.data for c in n.childNodes
+                                if c.nodeType == c.TEXT_NODE)
                 # Entries are compared with names coming from
                 # mercurial, so bytes with undefined encoding. Our
                 # best bet is to assume they are in local