remote-hg: don't decode UTF-8 paths into Unicode objects
[gitweb.git] / contrib / remote-helpers / git-remote-hg
index 0194c67fb1db1dc6fdd4bd90b67d04cfb7a34e1d..1c713e0af1894edba1166898c4301932fd7f2595 100755 (executable)
@@ -678,6 +678,11 @@ def get_merge_files(repo, p1, p2, files):
             f = { 'ctx' : repo[p1][e] }
             files[e] = f
 
+def c_style_unescape(string):
+    if string[0] == string[-1] == '"':
+        return string.decode('string-escape')[1:-1]
+    return string
+
 def parse_commit(parser):
     global marks, blob_marks, parsed_refs
     global mode
@@ -720,6 +725,7 @@ def parse_commit(parser):
             f = { 'deleted' : True }
         else:
             die('Unknown file command: %s' % line)
+        path = c_style_unescape(path)
         files[path] = f
 
     # only export the commits if we are on an internal proxy repo