Submitter | liscju |
---|---|
Date | Sept. 1, 2016, 8:08 p.m. |
Message ID | <fbf842ccbfcf26f3f110.1472760538@liscju-VirtualBox> |
Download | mbox | patch |
Permalink | /patch/16526/ |
State | Accepted |
Headers | show |
Comments
> On Sep 1, 2016, at 16:08, liscju <piotr.listkiewicz@gmail.com> wrote: > > # HG changeset patch > # User liscju <piotr.listkiewicz@gmail.com> > # Date 1472760402 -7200 > # Thu Sep 01 22:06:42 2016 +0200 > # Node ID fbf842ccbfcf26f3f110638ba6b174891bb0d69f > # Parent f148bfa40489269be2e48046734f81065129847a > help: show content for explicitly disabled extension (issue5228) > queued, thanks > diff --git a/mercurial/extensions.py b/mercurial/extensions.py > --- a/mercurial/extensions.py > +++ b/mercurial/extensions.py > @@ -22,6 +22,7 @@ from . import ( > ) > > _extensions = {} > +_disabledextensions = {} > _aftercallbacks = {} > _order = [] > _builtin = set(['hbisect', 'bookmarks', 'parentrevspec', 'progress', 'interhg', > @@ -148,6 +149,7 @@ def loadall(ui): > for (name, path) in result: > if path: > if path[0] == '!': > + _disabledextensions[name] = path[1:] > continue > try: > load(ui, name, path) > @@ -370,6 +372,7 @@ def _disabledpaths(strip_init=False): > if name in exts or name in _order or name == '__init__': > continue > exts[name] = path > + exts.update(_disabledextensions) > return exts > > def _moduledoc(file): > diff --git a/tests/test-help.t b/tests/test-help.t > --- a/tests/test-help.t > +++ b/tests/test-help.t > @@ -1623,6 +1623,17 @@ such str.lower(). >> ambiguous = ! >> EOF > > +Show help content of disabled extensions > + > + $ cat >> $HGRCPATH <<EOF > + > [extensions] > + > ambiguous = !./ambiguous.py > + > EOF > + $ hg help -e ambiguous > + ambiguous extension - (no help text available) > + > + (use "hg help extensions" for information on enabling extensions) > + > Test dynamic list of merge tools only shows up once > $ hg help merge-tools > Merge Tools > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
On Thu, 01 Sep 2016 22:08:58 +0200, liscju wrote: > # HG changeset patch > # User liscju <piotr.listkiewicz@gmail.com> > # Date 1472760402 -7200 > # Thu Sep 01 22:06:42 2016 +0200 > # Node ID fbf842ccbfcf26f3f110638ba6b174891bb0d69f > # Parent f148bfa40489269be2e48046734f81065129847a > help: show content for explicitly disabled extension (issue5228) The change looks good, but this isn't what issue5228 proposes, which says complete docstring should be available for unloaded extensions.
> > The change looks good, but this isn't what issue5228 proposes, which says > complete docstring should be available for unloaded extensions. I don't understand it, does it deal with unloaded extension that are not processed in extensions.loadall(not specified in hgrc)? In this case how do we know where to find those extensions? 2016-09-03 17:49 GMT+02:00 Yuya Nishihara <yuya@tcha.org>: > On Thu, 01 Sep 2016 22:08:58 +0200, liscju wrote: > > # HG changeset patch > > # User liscju <piotr.listkiewicz@gmail.com> > > # Date 1472760402 -7200 > > # Thu Sep 01 22:06:42 2016 +0200 > > # Node ID fbf842ccbfcf26f3f110638ba6b174891bb0d69f > > # Parent f148bfa40489269be2e48046734f81065129847a > > help: show content for explicitly disabled extension (issue5228) > > The change looks good, but this isn't what issue5228 proposes, which says > complete docstring should be available for unloaded extensions. >
On Mon, 5 Sep 2016 22:32:34 +0200, Piotr Listkiewicz wrote: > > The change looks good, but this isn't what issue5228 proposes, which says > > complete docstring should be available for unloaded extensions. > > I don't understand it, does it deal with unloaded extension that are not > processed in extensions.loadall(not specified in hgrc)? In this case how do > we know where to find those extensions? Just looks for the hgext directory. https://selenic.com/repo/hg/file/3.9.1/mercurial/extensions.py#l417 The issue says "hg help -e eol" should print the same content as "hg help -e eol --config extensions.eol=" even if eol isn't enabled. I think that will be doable by parsing the extension file. https://bz.mercurial-scm.org/show_bug.cgi?id=5228
> > Just looks for the hgext directory. > https://selenic.com/repo/hg/file/3.9.1/mercurial/extensions.py#l417 > The issue says "hg help -e eol" should print the same content as > "hg help -e eol --config extensions.eol=" even if eol isn't enabled. I > think > that will be doable by parsing the extension file. > https://bz.mercurial-scm.org/show_bug.cgi?id=5228 In https://selenic.com/repo/hg/file/3.9.1/mercurial/extensions.py#l380 doc variable contains top-level python documentation for the given file and it shows only summary line now. Maybe the way to fix would be just to return all translated doc with gettext(doc), are there any reason to do additional parsing? 2016-09-06 14:49 GMT+02:00 Yuya Nishihara <yuya@tcha.org>: > On Mon, 5 Sep 2016 22:32:34 +0200, Piotr Listkiewicz wrote: > > > The change looks good, but this isn't what issue5228 proposes, which > says > > > complete docstring should be available for unloaded extensions. > > > > I don't understand it, does it deal with unloaded extension that are not > > processed in extensions.loadall(not specified in hgrc)? In this case how > do > > we know where to find those extensions? > > Just looks for the hgext directory. > > https://selenic.com/repo/hg/file/3.9.1/mercurial/extensions.py#l417 > > The issue says "hg help -e eol" should print the same content as > "hg help -e eol --config extensions.eol=" even if eol isn't enabled. I > think > that will be doable by parsing the extension file. > > https://bz.mercurial-scm.org/show_bug.cgi?id=5228 >
On Tue, 6 Sep 2016 22:32:48 +0200, Piotr Listkiewicz wrote: > > Just looks for the hgext directory. > > https://selenic.com/repo/hg/file/3.9.1/mercurial/extensions.py#l417 > > The issue says "hg help -e eol" should print the same content as > > "hg help -e eol --config extensions.eol=" even if eol isn't enabled. I > > think > > that will be doable by parsing the extension file. > > https://bz.mercurial-scm.org/show_bug.cgi?id=5228 > > In https://selenic.com/repo/hg/file/3.9.1/mercurial/extensions.py#l380 doc > variable contains top-level python documentation for the given file and it > shows only summary line now. Maybe the way to fix would be just to return > all translated doc with gettext(doc), are there any reason to do additional > parsing? Indeed. Maybe we'll need to teach helpext() to read the whole doc string.
Patch
diff --git a/mercurial/extensions.py b/mercurial/extensions.py --- a/mercurial/extensions.py +++ b/mercurial/extensions.py @@ -22,6 +22,7 @@ from . import ( ) _extensions = {} +_disabledextensions = {} _aftercallbacks = {} _order = [] _builtin = set(['hbisect', 'bookmarks', 'parentrevspec', 'progress', 'interhg', @@ -148,6 +149,7 @@ def loadall(ui): for (name, path) in result: if path: if path[0] == '!': + _disabledextensions[name] = path[1:] continue try: load(ui, name, path) @@ -370,6 +372,7 @@ def _disabledpaths(strip_init=False): if name in exts or name in _order or name == '__init__': continue exts[name] = path + exts.update(_disabledextensions) return exts def _moduledoc(file): diff --git a/tests/test-help.t b/tests/test-help.t --- a/tests/test-help.t +++ b/tests/test-help.t @@ -1623,6 +1623,17 @@ such str.lower(). > ambiguous = ! > EOF +Show help content of disabled extensions + + $ cat >> $HGRCPATH <<EOF + > [extensions] + > ambiguous = !./ambiguous.py + > EOF + $ hg help -e ambiguous + ambiguous extension - (no help text available) + + (use "hg help extensions" for information on enabling extensions) + Test dynamic list of merge tools only shows up once $ hg help merge-tools Merge Tools