Mercurial > hg
changeset 44657:843418dc0b1b
extensions: refactor function for obtaining disabled extension help
The way this worked before was hgext.__index__ was consulted.
This file appears to only be present on some Windows distributions.
This file contains a dict mapping extension name to its summary line,
not its full docstring.
The problem with this is that code in the help system was calling
this function to resolve help text. If hgext.__index__ was present,
only the summary line would be displayed. If not, the full extension
help would be printed.
This commit changes the function to not use hgext.__index__ such that
it always returns the full extension help text.
As a result of this change, test-extension.t and test-qrecord.t
now pass when run from environments that have an hgext.__index__.
Differential Revision: https://phab.mercurial-scm.org/D8344
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 29 Mar 2020 14:22:07 -0700 |
parents | 15aef805619d |
children | 25436f83fb95 |
files | mercurial/extensions.py mercurial/help.py mercurial/hg.py |
diffstat | 3 files changed, 4 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/extensions.py Sun Mar 29 15:29:39 2020 -0700 +++ b/mercurial/extensions.py Sun Mar 29 14:22:07 2020 -0700 @@ -808,18 +808,8 @@ return exts -def disabledext(name): - '''find a specific disabled extension from hgext. returns desc''' - try: - from hgext import __index__ # pytype: disable=import-error - - if name in _order: # enabled - return - else: - return gettext(__index__.docs.get(name)) - except (ImportError, AttributeError): - pass - +def disabled_help(name): + """Obtain the full help text for a disabled extension, or None.""" paths = _disabledpaths() if name in paths: return _disabledhelp(paths[name])
--- a/mercurial/help.py Sun Mar 29 15:29:39 2020 -0700 +++ b/mercurial/help.py Sun Mar 29 14:22:07 2020 -0700 @@ -966,7 +966,7 @@ doc = gettext(pycompat.getdoc(mod)) or _(b'no help text available') except KeyError: mod = None - doc = extensions.disabledext(name) + doc = extensions.disabled_help(name) if not doc: raise error.UnknownCommand(name)
--- a/mercurial/hg.py Sun Mar 29 15:29:39 2020 -0700 +++ b/mercurial/hg.py Sun Mar 29 14:22:07 2020 -0700 @@ -695,7 +695,7 @@ # data. createopts[b'lfs'] = True - if extensions.disabledext(b'lfs'): + if extensions.disabled_help(b'lfs'): ui.status( _( b'(remote is using large file support (lfs), but it is '