Patchwork D2162: py3: preserve chunks as an iterable of bytes

login
register
mail settings
Submitter phabricator
Date Feb. 12, 2018, 2:36 a.m.
Message ID <differential-rev-PHID-DREV-xfst6plud3qayoouf3px-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/27629/
State Superseded
Headers show

Comments

phabricator - Feb. 12, 2018, 2:36 a.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  patch.diffstat() returns a bytes. util.chunkbuffer() expects an
  iterable of bytes. Feeding it a single bytes instance on Python 3
  will iterate the characters as integers. This blows up
  util.chunkbuffer.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/logcmdutil.py

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py
--- a/mercurial/logcmdutil.py
+++ b/mercurial/logcmdutil.py
@@ -81,7 +81,7 @@ 
     if fp is not None or ui.canwritewithoutlabels():
         out = fp or ui
         if stat:
-            chunks = patch.diffstat(util.iterlines(chunks), width=width)
+            chunks = [patch.diffstat(util.iterlines(chunks), width=width)]
         for chunk in util.filechunkiter(util.chunkbuffer(chunks)):
             out.write(chunk)
     else: