D3831: py3: use stringutil.pprint() to print NoneType

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Mon Jun 25 10:33:58 UTC 2018


pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/debugcommands.py
  tests/test-debugcommands.t

CHANGE DETAILS

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 @@
 
 #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
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -427,7 +427,7 @@
         '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:



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


More information about the Mercurial-devel mailing list