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

login
register
mail settings
Submitter Augie Fackler
Date March 8, 2017, 10:51 p.m.
Message ID <e71f92216d6ff54d0f2c.1489013479@augie-macbookair2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/19029/
State Superseded
Headers show

Comments

Augie Fackler - March 8, 2017, 10:51 p.m.
# HG changeset patch
# User Augie Fackler <raf@durin42.com>
# Date 1488570207 18000
#      Fri Mar 03 14:43:27 2017 -0500
# Node ID e71f92216d6ff54d0f2c7640f5574f6b69719836
# Parent  5fb879c5f256c4308651e4efdf2b3ca1a59df24a
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
@@ -745,6 +745,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('latin1')
                 for ui_ in uis:
                     ui_.setconfig('ui', opt, val, '--' + opt)