# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 2018-06-24 19:37:23 # Node ID a0c3d83d5f04de08520c0cb97e2a9d0df2d51be4 # Parent e6b643ccf87d73638c754fe9ced8c6add00413e3 py3: use stringutil.pprint() to print NoneType Before this patch, when running test-debugcommands.t, we get a TypeError because NoneType can't be converted into bytes. This patch uses stringutil.pprint() to print the ui._colormode. We are now close to getting test-debugcommands.t passing on Python 3. Differential Revision: https://phab.mercurial-scm.org/D3831 diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -427,7 +427,7 @@ def debugcheckstate(ui, repo): 'hg debugcolor') def debugcolor(ui, repo, **opts): """show available color, effects or style""" - ui.write(('color mode: %s\n') % ui._colormode) + ui.write(('color mode: %s\n') % stringutil.pprint(ui._colormode)) if opts.get(r'style'): return _debugdisplaystyle(ui) else: diff --git a/tests/test-debugcommands.t b/tests/test-debugcommands.t --- a/tests/test-debugcommands.t +++ b/tests/test-debugcommands.t @@ -337,7 +337,7 @@ Test debugcolor #if no-windows $ hg debugcolor --style --color always | egrep 'mode|style|log\.' - color mode: ansi + color mode: 'ansi' available style: \x1b[0;33mlog.changeset\x1b[0m: \x1b[0;33myellow\x1b[0m (esc) #endif