Mercurial > public > mercurial-scm > hg-stable
diff mercurial/revset.py @ 25632:015c0d1087a3
revset: don't suggest private or undocumented queries
I noticed when I mistyped 'matching', that it suggested '_matchfiles' as well.
Rather than simply exclude names that start with '_', this excludes anything
without a docstring. That way, if it isn't in the help text, it isn't
suggested, such as 'wdir()'.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sat, 20 Jun 2015 10:59:56 -0400 |
parents | c88082baf693 |
children | 1ddefcfcd3e6 |
line wrap: on
line diff
--- a/mercurial/revset.py Thu Jun 18 15:42:40 2015 -0500 +++ b/mercurial/revset.py Sat Jun 20 10:59:56 2015 -0400 @@ -391,7 +391,11 @@ def func(repo, subset, a, b): if a[0] == 'symbol' and a[1] in symbols: return symbols[a[1]](repo, subset, b) - raise error.UnknownIdentifier(a[1], symbols.keys()) + + keep = lambda fn: getattr(fn, '__doc__', None) is not None + + syms = [s for (s, fn) in symbols.items() if keep(fn)] + raise error.UnknownIdentifier(a[1], syms) # functions