[PATCH 3 of 4 py3] help: use pycompat.sysstr() to make `a in b` work

Yuya Nishihara yuya at tcha.org
Sun Mar 12 13:31:47 EDT 2017


On Sun, 12 Mar 2017 22:49:50 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit at gmail.com>
> # Date 1489338223 -19800
> #      Sun Mar 12 22:33:43 2017 +0530
> # Node ID 6cccbcf562c29d073d9cdf775fb07e40e32fad0b
> # Parent  782455a21077bef9c13532ad8dfa69fde1e5ebfc
> help: use pycompat.sysstr() to make `a in b` work
> 
> doc is unicode here, making doc bytes was an option but here we are just
> evaluating an expression so I guess the other way around will be okay.
> 
> diff -r 782455a21077 -r 6cccbcf562c2 mercurial/help.py
> --- a/mercurial/help.py	Sun Mar 12 22:27:53 2017 +0530
> +++ b/mercurial/help.py	Sun Mar 12 22:33:43 2017 +0530
> @@ -23,6 +23,7 @@
>      filemerge,
>      fileset,
>      minirst,
> +    pycompat,
>      revset,
>      templatefilters,
>      templatekw,
> @@ -109,7 +110,7 @@
>  def filtercmd(ui, cmd, kw, doc):
>      if not ui.debugflag and cmd.startswith("debug") and kw != "debug":
>          return True
> -    if not ui.verbose and doc and any(w in doc for w in _exclkeywords):
> +    if not ui.verbose and doc and any(pycompat.sysstr(w) in doc for w in _exclkeywords):
>          return True
>      return False

__doc__ should be converted to bytes (in local encoding) instead. Maybe we'll
need a helper something like pycompat.getdoc(func_or_class).

I've queued the other patches, thanks.


More information about the Mercurial-devel mailing list