D2162: py3: preserve chunks as an iterable of bytes

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Mon Feb 12 02:36:12 UTC 2018


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

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:



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


More information about the Mercurial-devel mailing list