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

login
register
mail settings
Submitter phabricator
Date June 25, 2018, 10:33 a.m.
Message ID <differential-rev-PHID-DREV-kp6ddlyql6yefkibqwrm-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/32407/
State Superseded
Headers show

Comments

phabricator - June 25, 2018, 10:33 a.m.
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




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

Patch

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: