diff mercurial/help.py @ 42413:ad55a0a5894f

help: include subtopic in error message if passed Differential Revision: https://phab.mercurial-scm.org/D6442
author Nathan Goldbaum <nathan12343@gmail.com>
date Thu, 23 May 2019 11:14:32 -0400
parents a84564b1a0b1
children 9d31581cc44e
line wrap: on
line diff
--- a/mercurial/help.py	Thu May 23 10:47:10 2019 -0400
+++ b/mercurial/help.py	Thu May 23 11:14:32 2019 -0400
@@ -453,7 +453,7 @@
 addtopichook('config', inserttweakrc)
 
 def help_(ui, commands, name, unknowncmd=False, full=True, subtopic=None,
-          **opts):
+          fullname=None, **opts):
     '''
     Generate the help for 'name' as unformatted restructured text. If
     'name' is None, describe the commands available.
@@ -814,8 +814,16 @@
             if unknowncmd:
                 raise error.UnknownCommand(name)
             else:
-                msg = _('no such help topic: %s') % name
-                hint = _("try 'hg help --keyword %s'") % name
+                if fullname:
+                    formatname = fullname
+                else:
+                    formatname = name
+                if subtopic:
+                    hintname = subtopic
+                else:
+                    hintname = name
+                msg = _('no such help topic: %s') % formatname
+                hint = _("try 'hg help --keyword %s'") % hintname
                 raise error.Abort(msg, hint=hint)
     else:
         # program name
@@ -850,7 +858,7 @@
     termwidth = ui.termwidth() - 2
     if textwidth <= 0 or termwidth < textwidth:
         textwidth = termwidth
-    text = help_(ui, commands, name,
+    text = help_(ui, commands, name, fullname=fullname,
                  subtopic=subtopic, unknowncmd=unknowncmd, full=full, **opts)
 
     blocks, pruned = minirst.parse(text, keep=keep)