# HG changeset patch # User Olav Reinert # Date 2012-06-06 23:42:50 # Node ID 87882c8753d47edbd71d527e9a7e12c1f1fe0eef # Parent a1eb17bed55090aaebf521fcc2823b36e7123a37 help: fix extension commands help in keyword search This patch fixes the synopsis shown for extension commands in keyword search results. A previous patch erroneously caused the extension synopsis to be shown instead. Test cases for keyword search are missing, so I added a one. diff --git a/mercurial/help.py b/mercurial/help.py --- a/mercurial/help.py +++ b/mercurial/help.py @@ -107,8 +107,8 @@ def topicmatch(kw): 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('^') - if mod.__doc__: - cmddoc = gettext(mod.__doc__).splitlines()[0] + if entry[0].__doc__: + cmddoc = gettext(entry[0].__doc__).splitlines()[0] else: cmddoc = _('(no help text available)') results['extensioncommands'].append((cmdname, cmddoc)) diff --git a/tests/test-help.t b/tests/test-help.t --- a/tests/test-help.t +++ b/tests/test-help.t @@ -775,3 +775,30 @@ Test help hooks $ hg help revsets | grep helphook helphook1 helphook2 + +Test keyword search help + + $ hg help -k clone + Topics: + + config Configuration Files + extensions Using Additional Features + glossary Glossary + phases Working with Phases + subrepo Subrepositories + urls URL Paths + + Commands: + + update update working directory (or switch revisions) + paths show aliases for remote repositories + clone make a copy of an existing repository + + Extensions: + + relink recreates hardlinks between repository clones + + Extension Commands: + + qclone clone main and patch repository at same time +