Patchwork [4,of,4] help: include a divider when the section depth changes

login
register
mail settings
Submitter timeless@mozdev.org
Date Dec. 30, 2015, 10:42 p.m.
Message ID <4a43698e37ecba02da9f.1451515346@waste.org>
Download mbox | patch
Permalink /patch/12426/
State Changes Requested
Delegated to: Yuya Nishihara
Headers show

Comments

timeless@mozdev.org - Dec. 30, 2015, 10:42 p.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1451514727 0
#      Wed Dec 30 22:32:07 2015 +0000
# Node ID 4a43698e37ecba02da9fbb3424e70132e7d3c781
# Parent  5196b885c3b846beff74236fa91839664d8b910e
help: include a divider when the section depth changes

This makes it easier to distinguish between:

"format"
--------
"usestore"
...
    Enabled by default.

and

"progress.format"
    Format of the progress bar.
Yuya Nishihara - Jan. 1, 2016, 8:49 a.m.
On Wed, 30 Dec 2015 16:42:26 -0600, timeless wrote:
> # HG changeset patch
> # User timeless <timeless@mozdev.org>
> # Date 1451514727 0
> #      Wed Dec 30 22:32:07 2015 +0000
> # Node ID 4a43698e37ecba02da9fbb3424e70132e7d3c781
> # Parent  5196b885c3b846beff74236fa91839664d8b910e
> help: include a divider when the section depth changes
> 
> This makes it easier to distinguish between:
> 
> "format"
> --------
> "usestore"
> ...
>     Enabled by default.
> 
> and
> 
> "progress.format"
>     Format of the progress bar.

Still it's hard for me to distinguish "progress.format" from "format".

Can it include all section headers up to the highest level?

  "format"
  --------
  "usestore"
  ...

  "progress"
  ----------
  "format"
timeless - Jan. 1, 2016, 6:55 p.m.
Yuya Nishihara wrote:
> Still it's hard for me to distinguish "progress.format" from "format".
>
> Can it include all section headers up to the highest level?

Yeah, I'll send a new patch for that.

Sadly, while I love pushgate, I've had a bunch of problems with it...
1. I think discovery is probably doing the wrong thing for `hg push -r REV`
(I've sent some patches to improve debugdiscovery so that I can start
thinking about it)
2. it's unfortunately very easy to accidentally pushgate clowncopter.
I did this:
hg pull clowncopter
hg co tip
hg rebase mywork
fixmywork
runhelptest
hg co @
hg graft tip
runhelptest
hg push -r .

unfortunately, `@` had moved, which means that what i really did was
create a second copy of my work as a child of clowncopter @, and then
I sent the first 8 patches of clowncopter to pushgate.
3. patches that i'm sending via pushgate seem to take a while to
arrive at the mailinglist.

I'm going to try to send my patch correctly against default/default,
but note that the test output will conflict with the tip of
clowncopter, you should be able to run the tests as the patch is,
confirm they're sane, rebase to tip of clowncopter, and use -i to
accept the changes.

specifically the order changes here:
29458:104239df8df7
help: refactor version/defaults from format section

and I'm going to run away for the weekend.

Patch

diff --git a/mercurial/minirst.py b/mercurial/minirst.py
--- a/mercurial/minirst.py
+++ b/mercurial/minirst.py
@@ -661,12 +661,17 @@ 
         sections = getsections(blocks)
         blocks = []
         i = 0
+        lastparents = []
         while i < len(sections):
             name, nest, b = sections[i]
             del parents[nest:]
             parents.append(name)
             if name == section:
-                b[0]['path'] = parents[3:]
+                if blocks and len(lastparents) != len(parents[3:]):
+                    blocks.append({'lines': ['      '], 'indent': 4,
+                                   'underline': '-', 'type': 'section'})
+                lastparents = parents[3:]
+                b[0]['path'] = lastparents
                 blocks.extend(b)
 
                 ## Also show all subnested sections
diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -1162,6 +1162,15 @@ 
   $ hg help config.type | egrep '^$'|wc -l
   \s*3 (re)
 
+Separate sections from subsections
+
+  $ hg help config.format | egrep '^    (".*format|-)'
+      "format"
+      --------
+      ------
+      "profiling.format"
+      "progress.format"
+
 Last item in help config.*:
 
   $ hg help config.`hg help config|grep '^    "'| \