comparison hgext/convert/subversion.py @ 41327:1281b2265ff5

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
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 23 Jan 2019 16:21:36 -0800
parents 4d6019c0e0ef
children 876494fd967d
comparison
equal deleted inserted replaced
41326:7c54357be2ae 41327:1281b2265ff5
1181 # already tracked entries, so we have to track and filter them 1181 # already tracked entries, so we have to track and filter them
1182 # ourselves. 1182 # ourselves.
1183 m = set() 1183 m = set()
1184 output = self.run0('ls', recursive=True, xml=True) 1184 output = self.run0('ls', recursive=True, xml=True)
1185 doc = xml.dom.minidom.parseString(output) 1185 doc = xml.dom.minidom.parseString(output)
1186 for e in doc.getElementsByTagName('entry'): 1186 for e in doc.getElementsByTagName(r'entry'):
1187 for n in e.childNodes: 1187 for n in e.childNodes:
1188 if n.nodeType != n.ELEMENT_NODE or n.tagName != 'name': 1188 if n.nodeType != n.ELEMENT_NODE or n.tagName != r'name':
1189 continue 1189 continue
1190 name = ''.join(c.data for c in n.childNodes 1190 name = r''.join(c.data for c in n.childNodes
1191 if c.nodeType == c.TEXT_NODE) 1191 if c.nodeType == c.TEXT_NODE)
1192 # Entries are compared with names coming from 1192 # Entries are compared with names coming from
1193 # mercurial, so bytes with undefined encoding. Our 1193 # mercurial, so bytes with undefined encoding. Our
1194 # best bet is to assume they are in local 1194 # best bet is to assume they are in local
1195 # encoding. They will be passed to command line calls 1195 # encoding. They will be passed to command line calls
1196 # later anyway, so they better be. 1196 # later anyway, so they better be.