# HG changeset patch # User Pierre-Yves David # Date 2014-04-17 00:01:03 # Node ID eb6eaef7ae446067fb37a1ad51c979fb7894d105 # Parent 2d93b74335a23d3f70aeebb138ca6be487239e2c help: provide a more helpful message when no keyword are matched Before this changeset, when no topic were matching the provided keyword ( in command such as `hg help --keyword babar`) the output was empty. This is confusing and unhelpful for new users seeking assistance in the help. We now display: $ hg help --keyword babar abort: no matches (try "hg help" for a list of topics) This send users in a new direction where they may find what they are looking for. 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 <