Patchwork [1,of,2] help: fix output of sections in `hg help foo.somesection`

login
register
mail settings
Submitter Jordi Gutiérrez Hermoso
Date Oct. 6, 2014, 2:56 p.m.
Message ID <3fa01b749ab5a44a214b.1412607372@Iris>
Download mbox | patch
Permalink /patch/6143/
State Accepted
Commit 3f808549d426e435e28dff14452d1aafee317a31
Headers show

Comments

Jordi Gutiérrez Hermoso - Oct. 6, 2014, 2:56 p.m.
# HG changeset patch
# User Jordi Gutiérrez Hermoso <jordigh@octave.org>
# Date 1412594978 14400
#      Mon Oct 06 07:29:38 2014 -0400
# Node ID 3fa01b749ab5a44a214bc0936223bd280bb24b79
# Parent  889789a2ca9f19755bf0d302c8671f850e42a059
help: fix output of sections in `hg help foo.somesection`

There was a bug in c3c3dd31fe1c. The block that added definitions to
getsections should have been an elif, not an if. Otherwise section
titles get added twice, since the else clause would always get
executed for section titles.

Patch

diff --git a/mercurial/minirst.py b/mercurial/minirst.py
--- a/mercurial/minirst.py
+++ b/mercurial/minirst.py
@@ -687,7 +687,7 @@  def getsections(blocks):
             level = nest.index(i) + 1
             nest = nest[:level]
             secs.append((getname(b), level, [b]))
-        if b['type'] == 'definition':
+        elif b['type'] == 'definition':
             i = ' '
             if i not in nest:
                 nest += i