# HG changeset patch # User Gregory Szorc # Date 2014-08-30 18:06:24 # Node ID e284de138f00676f33a0d8a390dd79fafcf5087d # Parent e1d5fcab58b6c135c0e26546af2baf1a0c39f978 help: only call doc() when it is callable `hg help -k` on my machine was aborting because the hg-prompt extension was inserting a string and not a function into help.helptable and help was blindly calling it. This patch changes keyword searching to be more robust against unexpected types. diff --git a/mercurial/help.py b/mercurial/help.py --- a/mercurial/help.py +++ b/mercurial/help.py @@ -86,9 +86,10 @@ def topicmatch(kw): 'extensioncommands': [], } for names, header, doc in helptable: + # Old extensions may use a str as doc. if (sum(map(lowercontains, names)) or lowercontains(header) - or lowercontains(doc())): + or (callable(doc) and lowercontains(doc()))): results['topics'].append((names[0], header)) import commands # avoid cycle for cmd, entry in commands.table.iteritems():