[PATCH] registrar: make format strings unicodes and not bytes

Gregory Szorc gregory.szorc at gmail.com
Fri Oct 7 09:18:22 EDT 2016


LGTM. As a refresher, we don't rewrite docstrings to b'' in the module
transformer because Python 3 doesn't like that. Python 2 accepts both str
and unicode for docstrings.

On Fri, Oct 7, 2016 at 2:49 PM, Augie Fackler <raf at durin42.com> wrote:

> # HG changeset patch
> # User Augie Fackler <augie at google.com>
> # Date 1475843538 14400
> #      Fri Oct 07 08:32:18 2016 -0400
> # Node ID c79b21f1d5dea9de719504be30ebdb5635263d37
> # Parent  f3a2125968377fb1d4b9ea3f4917260d5aca3536
> registrar: make format strings unicodes and not bytes
>
> Fixes issues on Python 3, wherein docstrings are unicodes. Shouldn't
> break anything on Python 2.
>
> diff --git a/mercurial/registrar.py b/mercurial/registrar.py
> --- a/mercurial/registrar.py
> +++ b/mercurial/registrar.py
> @@ -121,7 +121,7 @@ class revsetpredicate(_funcregistrarbase
>      Otherwise, explicit 'revset.loadpredicate()' is needed.
>      """
>      _getname = _funcregistrarbase._parsefuncdecl
> -    _docformat = "``%s``\n    %s"
> +    _docformat = u"``%s``\n    %s"
>
>      def _extrasetup(self, name, func, safe=False, takeorder=False):
>          func._safe = safe
> @@ -160,7 +160,7 @@ class filesetpredicate(_funcregistrarbas
>      Otherwise, explicit 'fileset.loadpredicate()' is needed.
>      """
>      _getname = _funcregistrarbase._parsefuncdecl
> -    _docformat = "``%s``\n    %s"
> +    _docformat = u"``%s``\n    %s"
>
>      def _extrasetup(self, name, func, callstatus=False,
> callexisting=False):
>          func._callstatus = callstatus
> @@ -169,7 +169,7 @@ class filesetpredicate(_funcregistrarbas
>  class _templateregistrarbase(_funcregistrarbase):
>      """Base of decorator to register functions as template specific one
>      """
> -    _docformat = ":%s: %s"
> +    _docformat = u":%s: %s"
>
>  class templatekeyword(_templateregistrarbase):
>      """Decorator to register template keyword
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20161007/d0f0fe3c/attachment.html>


More information about the Mercurial-devel mailing list