[PATCH v4] command options: prohibit unicode defaults

Yuya Nishihara yuya at tcha.org
Sat Sep 2 08:34:37 EDT 2017


On Fri, 01 Sep 2017 16:30:47 +0200, Christophe de Vienne wrote:
> # HG changeset patch
> # User Christophe de Vienne <christophe at cdevienne.info>
> # Date 1504023891 -7200
> #      Tue Aug 29 18:24:51 2017 +0200
> # Node ID 44e9719c499dae04eca36178ddfb2c5eddec6beb
> # Parent  b2eb0aa445cbe7cadc8b7691c6266908adfc5057
> command options: prohibit unicode defaults

> diff -r b2eb0aa445cb -r 44e9719c499d mercurial/extensions.py
> --- a/mercurial/extensions.py	Tue Aug 22 21:21:43 2017 -0400
> +++ b/mercurial/extensions.py	Tue Aug 29 18:24:51 2017 +0200
> @@ -133,6 +133,14 @@
>                            "registrar.command to register '%s'" % c, '4.6')
>          missing = [a for a in _cmdfuncattrs if not util.safehasattr(f, a)]
>          if not missing:
> +            for option in e[1]:
> +                default = option[2]
> +                if isinstance(default, type(u'')):
> +                    raise error.ProgrammingError(
> +                        "option '%s.%s' has a unicode default value"
> +                        % (c, option[1]),
> +                        "change the %s.%s default value to a "
> +                        "non-unicode string" % (c, option[1]))

The hint has to be passed as a keyword argument. Fixed in flight.


More information about the Mercurial-devel mailing list