Patchwork D5737: py3: convert info.name to bytes in subrepo.py

login
register
mail settings
Submitter phabricator
Date Jan. 29, 2019, 10:27 p.m.
Message ID <differential-rev-PHID-DREV-6bj26bxl2pirgjezid6l-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/38166/
State New
Headers show

Comments

phabricator - Jan. 29, 2019, 10:27 p.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5737

AFFECTED FILES
  mercurial/subrepo.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel
Yuya Nishihara - Jan. 30, 2019, 12:19 p.m.
>          for info in tar:
> +            infoname = pycompat.bytestr(info.name)

So `info.name` would come from environment. It's probably better to use
`encoding.strtolocal()`.
phabricator - Jan. 30, 2019, 12:21 p.m.
yuja added a comment.


  >   for info in tar:
  > 
  > +            infoname = pycompat.bytestr(info.name)
  
  So `info.name` would come from environment. It's probably better to use
  `encoding.strtolocal()`.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5737

To: pulkit, #hg-reviewers
Cc: yuja, mercurial-devel

Patch

diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -1658,15 +1658,16 @@ 
                                         unit=_('files'))
         progress.update(0)
         for info in tar:
+            infoname = pycompat.bytestr(info.name)
             if info.isdir():
                 continue
-            if match and not match(info.name):
+            if match and not match(infoname):
                 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 + '/' + infoname,
                              info.mode, info.issym(), data)
             total += 1
             progress.increment()