diff mercurial/minirst.py @ 22770:de9424647fe4

help: show all nested subsections of a section with `hg help foo.section` Used to be that `hg help hgrc.paths` would show "paths" ------- Assigns symbolic names to repositories. The left side is the symbolic name, and the right gives the directory or URL that is the location of the repository. Default paths can be declared by setting the following entries. and stop there. Obviously the result seems better as shown in the attached test.
author Jordi Guti?rrez Hermoso <jordigh@octave.org>
date Mon, 06 Oct 2014 07:35:53 -0400
parents 3f808549d426
children 2a8d8b4097c8
line wrap: on
line diff
--- a/mercurial/minirst.py	Mon Oct 06 07:29:38 2014 -0400
+++ b/mercurial/minirst.py	Mon Oct 06 07:35:53 2014 -0400
@@ -654,9 +654,18 @@
     if section:
         sections = getsections(blocks)
         blocks = []
-        for name, nest, b in sections:
+        i = 0
+        while i < len(sections):
+            name, nest, b = sections[i]
             if name == section:
-                blocks = b
+                blocks.extend(b)
+
+                ## Also show all subnested sections
+                while i + 1 < len(sections) and sections[i + 1][1] > nest:
+                    i += 1
+                    blocks.extend(sections[i][2])
+            i += 1
+
     if style == 'html':
         text = formathtml(blocks)
     else: