[PATCH 5 of 8 py3 v3] dispatch: enforce bytes when converting boolean flags to config items

Martijn Pieters mj at zopatista.com
Sat Mar 11 14:07:42 EST 2017


On 8 March 2017 at 15:22, Augie Fackler <raf at durin42.com> wrote:

> # HG changeset patch
> # User Augie Fackler <raf at durin42.com>
> # Date 1488570207 18000
> #      Fri Mar 03 14:43:27 2017 -0500
> # Node ID 9269a48bd35f1eaafdb00c58c6056382c6a0ba88
> # Parent  aa38d91cc90fe6b4c600f0f096fe45755b383193
> dispatch: enforce bytes when converting boolean flags to config items
>
> This fixes --verbose on Python 3.
>
> 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')
>

Why latin1? I'd use ASCII here, as that's plenty to encode `'True'` and
`'False'`, the two possible string values here.


>                  for ui_ in uis:
>                      ui_.setconfig('ui', opt, val, '--' + opt)
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>



-- 
Martijn Pieters
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20170311/f4edf76a/attachment.html>


More information about the Mercurial-devel mailing list