diff --git a/mercurial/help.py b/mercurial/help.py --- a/mercurial/help.py +++ b/mercurial/help.py @@ -481,6 +481,10 @@ def help_(ui, name, unknowncmd=False, fu rst.append('%s:\n\n' % title) rst.extend(minirst.maketable(sorted(matches[t]), 1)) rst.append('\n') + if not rst: + msg = _('no matches') + hint = _('try "hg help" for a list of topics') + raise util.Abort(msg, hint=hint) elif name and name != 'shortlist': i = None if unknowncmd: diff --git a/tests/test-help.t b/tests/test-help.t --- a/tests/test-help.t +++ b/tests/test-help.t @@ -988,6 +988,13 @@ Test keyword search help qclone clone main and patch repository at same time +Test unfound keyword + + $ hg help --keyword nonexistingwordthatwillneverexisteverever + abort: no matches + (try "hg help" for a list of topics) + [255] + Test omit indicating for help $ cat > addverboseitems.py <