Patchwork [3,of,6,py3,v4] dispatch: enforce bytes when converting boolean flags to config items

login
register
mail settings
Submitter Augie Fackler
Date March 11, 2017, 7:39 p.m.
Message ID <89063bba547df62c98ec.1489261155@augie-macbookair2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/19106/
State Accepted
Headers show

Comments

Augie Fackler - March 11, 2017, 7:39 p.m.
# HG changeset patch
# User Augie Fackler <raf@durin42.com>
# Date 1488570207 18000
#      Fri Mar 03 14:43:27 2017 -0500
# Node ID 89063bba547df62c98ecee5700c8bd773cb6ef8d
# Parent  4e079d87982a89c789565b0ff83393d439fc10f6
dispatch: enforce bytes when converting boolean flags to config items

This fixes --verbose on Python 3.

Patch

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -747,6 +747,8 @@  def _dispatch(req):
         if options['verbose'] or options['debug'] or options['quiet']:
             for opt in ('verbose', 'debug', 'quiet'):
                 val = str(bool(options[opt]))
+                if pycompat.ispy3:
+                    val = val.encode('ascii')
                 for ui_ in uis:
                     ui_.setconfig('ui', opt, val, '--' + opt)