subrepo: bytes/str cleanups on Git support
authorAugie Fackler <augie@google.com>
Wed, 30 Jan 2019 19:29:32 -0500
changeset 41497 46ab0c6b28dc
parent 41496 b58d608ec6a0
child 41498 7f366dd3df1f
subrepo: bytes/str cleanups on Git support Git subrepo tests now pass on Python 3. Differential Revision: https://phab.mercurial-scm.org/D5768
contrib/python3-whitelist
mercurial/subrepo.py
--- a/contrib/python3-whitelist	Wed Jan 30 16:54:34 2019 -0800
+++ b/contrib/python3-whitelist	Wed Jan 30 19:29:32 2019 -0500
@@ -679,6 +679,7 @@
 test-strip-cross.t
 test-strip.t
 test-subrepo-deep-nested-change.t
+test-subrepo-git.t
 test-subrepo-missing.t
 test-subrepo-paths.t
 test-subrepo-recursion.t
--- a/mercurial/subrepo.py	Wed Jan 30 16:54:34 2019 -0800
+++ b/mercurial/subrepo.py	Wed Jan 30 19:29:32 2019 -0500
@@ -1284,7 +1284,7 @@
         if stream:
             return p.stdout, None
 
-        retdata = p.stdout.read().strip()
+        retdata = pycompat.fsencode(p.stdout.read().strip())
         # wait for the child to exit to avoid race condition.
         p.wait()
 
@@ -1660,13 +1660,14 @@
         for info in tar:
             if info.isdir():
                 continue
-            if match and not match(info.name):
+            bname = pycompat.fsencode(info.name)
+            if match and not match(bname):
                 continue
             if info.issym():
                 data = info.linkname
             else:
                 data = tar.extractfile(info).read()
-            archiver.addfile(prefix + self._path + '/' + info.name,
+            archiver.addfile(prefix + self._path + '/' + bname,
                              info.mode, info.issym(), data)
             total += 1
             progress.increment()