changeset 25723:2a8d8b4097c8

help: support 'hg help template.somekeyword' Previously the output was simply 'abort: help section not found'.
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 04 Jul 2015 23:11:32 -0400
parents eb15c5be381c
children 4474a750413f
files mercurial/minirst.py tests/test-help.t
diffstat 2 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/minirst.py	Thu Jul 02 00:04:08 2015 -0400
+++ b/mercurial/minirst.py	Sat Jul 04 23:11:32 2015 -0400
@@ -682,7 +682,10 @@
     secs = []
 
     def getname(b):
-        x = b['lines'][0]
+        if b['type'] == 'field':
+            x = b['key']
+        else:
+            x = b['lines'][0]
         x = x.lower().strip('"')
         if '(' in x:
             x = x.split('(')[0]
@@ -696,7 +699,7 @@
             level = nest.index(i) + 1
             nest = nest[:level]
             secs.append((getname(b), level, [b]))
-        elif b['type'] == 'definition':
+        elif b['type'] in ('definition', 'field'):
             i = ' '
             if i not in nest:
                 nest += i
--- a/tests/test-help.t	Thu Jul 02 00:04:08 2015 -0400
+++ b/tests/test-help.t	Sat Jul 04 23:11:32 2015 -0400
@@ -1117,6 +1117,10 @@
   abort: help section not found
   [255]
 
+  $ hg help template.files
+      files         List of strings. All files modified, added, or removed by
+                    this changeset.
+
 Test dynamic list of merge tools only shows up once
   $ hg help merge-tools
   Merge Tools