mercurial/commands.py
changeset 22587 c3c3dd31fe1c
parent 22585 15282c6612fb
child 22591 9fe33afc00b4
--- a/mercurial/commands.py	Tue Sep 30 15:55:30 2014 -0500
+++ b/mercurial/commands.py	Tue Sep 30 16:40:10 2014 -0500
@@ -3834,14 +3834,23 @@
         keep.append('unix')
         keep.append(sys.platform.lower())
 
+    section = None
+    if name and '.' in name:
+        name, section = name.split('.')
+
     text = help.help_(ui, name, **opts)
 
-    formatted, pruned = minirst.format(text, textwidth, keep=keep)
+    formatted, pruned = minirst.format(text, textwidth, keep=keep,
+                                       section=section)
+    if section and not formatted:
+        raise util.Abort(_("help section not found"))
+
     if 'verbose' in pruned:
         keep.append('omitted')
     else:
         keep.append('notomitted')
-    formatted, pruned = minirst.format(text, textwidth, keep=keep)
+    formatted, pruned = minirst.format(text, textwidth, keep=keep,
+                                       section=section)
     ui.write(formatted)