Mercurial > public > mercurial-scm > hg
comparison mercurial/extensions.py @ 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 | 9d2b2df2c2ba |
children | 5d09a120b4be |
comparison
equal
deleted
inserted
replaced
44656:15aef805619d | 44657:843418dc0b1b |
---|---|
806 exts[name] = doc.splitlines()[0] | 806 exts[name] = doc.splitlines()[0] |
807 | 807 |
808 return exts | 808 return exts |
809 | 809 |
810 | 810 |
811 def disabledext(name): | 811 def disabled_help(name): |
812 '''find a specific disabled extension from hgext. returns desc''' | 812 """Obtain the full help text for a disabled extension, or None.""" |
813 try: | |
814 from hgext import __index__ # pytype: disable=import-error | |
815 | |
816 if name in _order: # enabled | |
817 return | |
818 else: | |
819 return gettext(__index__.docs.get(name)) | |
820 except (ImportError, AttributeError): | |
821 pass | |
822 | |
823 paths = _disabledpaths() | 813 paths = _disabledpaths() |
824 if name in paths: | 814 if name in paths: |
825 return _disabledhelp(paths[name]) | 815 return _disabledhelp(paths[name]) |
826 | 816 |
827 | 817 |