[PATCH 3 of 3] help: fix help -c/help -e/help -k

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu Dec 10 15:00:06 CST 2015



On 12/09/2015 07:24 PM, timeless wrote:
> # HG changeset patch
> # User timeless <timeless at mozdev.org>
> # Date 1449640614 0
> #      Wed Dec 09 05:56:54 2015 +0000
> # Node ID 7e75db1c2e699cd7cfc92992850df9a787180813
> # Parent  cb8a737055a013a3c02c62825ae074a1af0513a4
> help: fix help -c/help -e/help -k

pushed to the clowncopter with a couple of fix.


> @@ -374,7 +374,8 @@
>               else:
>                   rst.append(' :%s: %s\n' % (f, h[f]))
>
> -        if not name:
> +        if not name and (opts.get('keyword') or not
> +                         (opts.get('command') or opts.get('extension'))):
>               exts = listexts(_('enabled extensions:'), extensions.enabled())
>               if exts:
>                   rst.append('\n')

I made computed the right side of the "and" in a dedicated variable.


> @@ -491,8 +492,8 @@
>
>       rst = []
>       kw = opts.get('keyword')
> -    if kw:
> -        matches = topicmatch(ui, name)
> +    if kw or name is None and {(o, opts[o]) for o in opts if opts[o]}:
> +        matches = topicmatch(ui, name or '')
>           helpareas = []
>           if opts.get('extension'):
>               helpareas += [('extensions', _('Extensions'))]

I've remove the strange set comprehension (2.7 only) by a simpler:

   any(opts[o] for o in opts)


-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list