Patchwork [1,of,4] formatter: use stringutil.pprint() in debug output to drop b''

login
register
mail settings
Submitter Yuya Nishihara
Date Oct. 14, 2018, 6:21 a.m.
Message ID <b28a63d39d280a081a2d.1539498097@mimosa>
Download mbox | patch
Permalink /patch/35946/
State Accepted
Headers show

Comments

Yuya Nishihara - Oct. 14, 2018, 6:21 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1539492679 -7200
#      Sun Oct 14 06:51:19 2018 +0200
# Node ID b28a63d39d280a081a2de1f96c5c7276aef6a0e1
# Parent  8783710b1d58d2ccc0f611904af244a1dde214d4
formatter: use stringutil.pprint() in debug output to drop b''
Gregory Szorc - Oct. 14, 2018, 7:39 a.m.
On Sun, Oct 14, 2018 at 8:34 AM Yuya Nishihara <yuya@tcha.org> wrote:

> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1539492679 -7200
> #      Sun Oct 14 06:51:19 2018 +0200
> # Node ID b28a63d39d280a081a2de1f96c5c7276aef6a0e1
> # Parent  8783710b1d58d2ccc0f611904af244a1dde214d4
> formatter: use stringutil.pprint() in debug output to drop b''
>

Queued, thanks.


>
> diff --git a/mercurial/formatter.py b/mercurial/formatter.py
> --- a/mercurial/formatter.py
> +++ b/mercurial/formatter.py
> @@ -129,7 +129,10 @@ from . import (
>      templateutil,
>      util,
>  )
> -from .utils import dateutil
> +from .utils import (
> +    dateutil,
> +    stringutil,
> +)
>
>  pickle = util.pickle
>
> @@ -321,7 +324,7 @@ class debugformatter(baseformatter):
>          self._out = out
>          self._out.write("%s = [\n" % self._topic)
>      def _showitem(self):
> -        self._out.write('    %s,\n' % pycompat.byterepr(self._item))
> +        self._out.write('    %s,\n' % stringutil.pprint(self._item))
>      def end(self):
>          baseformatter.end(self)
>          self._out.write("]\n")
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

Patch

diff --git a/mercurial/formatter.py b/mercurial/formatter.py
--- a/mercurial/formatter.py
+++ b/mercurial/formatter.py
@@ -129,7 +129,10 @@  from . import (
     templateutil,
     util,
 )
-from .utils import dateutil
+from .utils import (
+    dateutil,
+    stringutil,
+)
 
 pickle = util.pickle
 
@@ -321,7 +324,7 @@  class debugformatter(baseformatter):
         self._out = out
         self._out.write("%s = [\n" % self._topic)
     def _showitem(self):
-        self._out.write('    %s,\n' % pycompat.byterepr(self._item))
+        self._out.write('    %s,\n' % stringutil.pprint(self._item))
     def end(self):
         baseformatter.end(self)
         self._out.write("]\n")