Commit 469a541c authored by Philip Thiem's avatar Philip Thiem

Tweaks to get everything to pass again.

--HG--
extra : rebase_source : 352b6baf81e891d13f7310bbeb94d2cfce9dbad8
parent a6e7ef0a
...@@ -121,6 +121,7 @@ def parse_dir_entries(decoded_str): ...@@ -121,6 +121,7 @@ def parse_dir_entries(decoded_str):
def parse_externals_xml(decoded_str, prefix=''): def parse_externals_xml(decoded_str, prefix=''):
'''Parse a propget svn:externals xml''' '''Parse a propget svn:externals xml'''
prefix = os.path.normpath(prefix) prefix = os.path.normpath(prefix)
prefix = os.path.normcase(prefix)
doc = xml.dom.pulldom.parseString(_get_xml_data(decoded_str)) doc = xml.dom.pulldom.parseString(_get_xml_data(decoded_str))
externals = list() externals = list()
...@@ -129,6 +130,9 @@ def parse_externals_xml(decoded_str, prefix=''): ...@@ -129,6 +130,9 @@ def parse_externals_xml(decoded_str, prefix=''):
if event == 'START_ELEMENT' and node.nodeName == 'target': if event == 'START_ELEMENT' and node.nodeName == 'target':
doc.expandNode(node) doc.expandNode(node)
path = os.path.normpath(node.getAttribute('path')) path = os.path.normpath(node.getAttribute('path'))
log.warn('')
log.warn('PRE: %s' % prefix)
log.warn('PTH: %s' % path)
if os.path.normcase(path).startswith(prefix): if os.path.normcase(path).startswith(prefix):
path = path[len(prefix)+1:] path = path[len(prefix)+1:]
......
...@@ -114,20 +114,21 @@ class ParserExternalXML(unittest.TestCase): ...@@ -114,20 +114,21 @@ class ParserExternalXML(unittest.TestCase):
folder3 = 'third_party3' folder3 = 'third_party3'
expected = set([ expected = set([
"\\".join((example_base, folder2)), os.sep.join((example_base, folder2)),
"\\".join((example_base, folder3)), os.sep.join((example_base, folder3)),
#third_party大介 #third_party大介
"\\".join((example_base, os.sep.join((example_base,
unicode('third_party') + unicode('third_party') +
unichr(0x5927) + unichr(0x4ecb))), unichr(0x5927) + unichr(0x4ecb))),
"\\".join((example_base, 'folder', folder2)), os.sep.join((example_base, 'folder', folder2)),
"\\".join((example_base, 'folder', folder3)), os.sep.join((example_base, 'folder', folder3)),
"\\".join((example_base, 'folder', os.sep.join((example_base, 'folder',
unicode('third_party') + unicode('third_party') +
unichr(0x5927) + unichr(0x4ecb))), unichr(0x5927) + unichr(0x4ecb))),
]) ])
dir_base = r'c:\development\svn_example' expected = set(os.path.normpath(x) for x in expected)
dir_base = os.sep.join(('C:', 'development', 'svn_example'))
self.assertEqual(set(x for x \ self.assertEqual(set(x for x \
in svn_utils.parse_externals_xml(data, dir_base)), expected) in svn_utils.parse_externals_xml(data, dir_base)), expected)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment