# HG changeset patch # User Thomas Arendsen Hein # Date 1339077280 -7200 # Node ID 4fd1f1d7569bceef4cbb98603f4968bb36ccb289 # Parent 2255950e1f7663a9faa6b57040cc5c0debe7d4dd help: fix 'hg help -k' matching an extension without docs getattr is not needed, __doc__ always exists and defaults to None diff -r 2255950e1f76 -r 4fd1f1d7569b mercurial/help.py --- a/mercurial/help.py Wed Jun 06 21:17:33 2012 -0500 +++ b/mercurial/help.py Thu Jun 07 15:54:40 2012 +0200 @@ -107,8 +107,11 @@ for cmd, entry in getattr(mod, 'cmdtable', {}).iteritems(): if kw in cmd or (len(entry) > 2 and lowercontains(entry[2])): cmdname = cmd.split('|')[0].lstrip('^') - cmddoc=getattr(mod, '__doc__', '').splitlines()[0] - results['extensioncommands'].append((cmdname, _(cmddoc))) + if mod.__doc__: + cmddoc = gettext(mod.__doc__).splitlines()[0] + else: + cmddoc = _('(no help text available)') + results['extensioncommands'].append((cmdname, cmddoc)) return results def loaddoc(topic): diff -r 2255950e1f76 -r 4fd1f1d7569b tests/test-help.t --- a/tests/test-help.t Wed Jun 06 21:17:33 2012 -0500 +++ b/tests/test-help.t Thu Jun 07 15:54:40 2012 +0200 @@ -598,6 +598,15 @@ use "hg -v help nohelp" to show more info + $ hg help -k nohelp + Commands: + + nohelp hg nohelp + + Extension Commands: + + nohelp (no help text available) + Test that default list of commands omits extension commands $ hg help