[PATCH] mercurial: pass ui to extensions.load (issue5007)
Yuya Nishihara
yuya at tcha.org
Wed Jan 6 07:41:09 CST 2016
On Tue, 5 Jan 2016 14:30:47 +0000, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark at fb.com>
> # Date 1450348217 0
> # Thu Dec 17 10:30:17 2015 +0000
> # Node ID 216c6e0c002b75f4cc2a485e40960e38dc2bba21
> # Parent b8405d739149cdd6d8d9bd5e3dd2ad8487b1f09a
> mercurial: pass ui to extensions.load (issue5007)
>
> extensions.load does need ui argument to print error if an extension
> fails to load.
>
> diff --git a/doc/gendoc.py b/doc/gendoc.py
> --- a/doc/gendoc.py
> +++ b/doc/gendoc.py
> @@ -110,7 +110,7 @@
> " :depth: 1\n\n")
>
> for extensionname in sorted(allextensionnames()):
> - mod = extensions.load(None, extensionname, None)
> + mod = extensions.load(ui, extensionname, None)
> ui.write(minirst.subsection(extensionname))
> ui.write("%s\n\n" % gettext(mod.__doc__))
> cmdtable = getattr(mod, 'cmdtable', None)
> diff --git a/mercurial/help.py b/mercurial/help.py
> --- a/mercurial/help.py
> +++ b/mercurial/help.py
> @@ -149,8 +149,7 @@
> for name, docs in itertools.chain(
> extensions.enabled(False).iteritems(),
> extensions.disabled().iteritems()):
> - # extensions.load ignores the UI argument
> - mod = extensions.load(None, name, '')
> + mod = extensions.load(ui, name, '')
> name = name.rpartition('.')[-1]
> if lowercontains(name) or lowercontains(docs):
> # extension docs are already translated
Pushed to the clowncopter, thanks.
Regarding your question, "What's the benefit not passing ui here?":
There should be no benefit. They didn't pass ui because they didn't have
"ui" object until recently.
More information about the Mercurial-devel
mailing list