git: a little pycompat.bytestring() love to make this code work in py3
authorAugie Fackler <augie@google.com>
Wed, 30 Jan 2019 18:32:11 -0500
changeset 41478 8e0dd36f7a97
parent 41477 4caf56c33009
child 41479 6bbb12cba5a8
git: a little pycompat.bytestring() love to make this code work in py3 Differential Revision: https://phab.mercurial-scm.org/D5765
contrib/python3-whitelist
hgext/convert/git.py
--- a/contrib/python3-whitelist	Thu Jan 24 16:07:32 2019 -0500
+++ b/contrib/python3-whitelist	Wed Jan 30 18:32:11 2019 -0500
@@ -116,6 +116,7 @@
 test-convert-cvsnt-mergepoints.t
 test-convert-datesort.t
 test-convert-filemap.t
+test-convert-git.t
 test-convert-hg-sink.t
 test-convert-hg-source.t
 test-convert-hg-startrev.t
--- a/hgext/convert/git.py	Thu Jan 24 16:07:32 2019 -0500
+++ b/hgext/convert/git.py	Wed Jan 30 18:32:11 2019 -0500
@@ -13,6 +13,7 @@
     config,
     error,
     node as nodemod,
+    pycompat,
 )
 
 from . import (
@@ -175,7 +176,8 @@
         self.catfilepipe[0].flush()
         info = self.catfilepipe[1].readline().split()
         if info[1] != ftype:
-            raise error.Abort(_('cannot read %r object at %s') % (ftype, rev))
+            raise error.Abort(_('cannot read %r object at %s') % (
+                pycompat.bytestr(ftype), rev))
         size = int(info[2])
         data = self.catfilepipe[1].read(size)
         if len(data) < size:
@@ -294,7 +296,7 @@
             if not entry:
                 if not l.startswith(':'):
                     continue
-                entry = l.split()
+                entry = tuple(pycompat.bytestr(p) for p in l.split())
                 continue
             f = l
             if entry[4][0] == 'C':