changeset 1529:dee572a4e30b

subvertpy: ensure paths are really always bytes
author Augie Fackler <raf@durin42.com>
date Thu, 31 Aug 2017 01:19:11 -0400
parents 4e28e01f57da
children 9a3b2b3fe4ce
files hgsubversion/svnwrap/subvertpy_wrapper.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/svnwrap/subvertpy_wrapper.py
+++ b/hgsubversion/svnwrap/subvertpy_wrapper.py
@@ -102,6 +102,12 @@ def prompt_callback(callback):
     subvertpy.NODE_FILE: 'f',
 }
 
+_unitype = type(u'')
+def _forceutf8(s):
+    if isinstance(s, _unitype):
+        return s.encode('utf-8')
+    return s
+
 class PathAdapter(object):
     __slots__ = ('action', 'copyfrom_path', 'copyfrom_rev')
 
@@ -360,9 +366,9 @@ class SubversionRepo(object):
                              props.get(properties.PROP_REVISION_AUTHOR),
                              props.get(properties.PROP_REVISION_LOG),
                              props.get(properties.PROP_REVISION_DATE),
-                             dict([(k, PathAdapter(*v))
+                             dict([(_forceutf8(k), PathAdapter(*v))
                                    for k, v in paths.iteritems()]),
-                             strip_path=self.subdir)
+                             strip_path=_forceutf8(self.subdir))
                 revisions.append(r)
             # we only access revisions in a FIFO manner
             revisions = collections.deque()