# HG changeset patch # User "Yann E. MORIN" # Date 1331330057 -3600 # Node ID 684864d54903e4d15a0fd6f3368574a1fa50cac5 # Parent 0d175ac527c1d1b51b1de6dff25907ae377b9280 help: strip doctest from dochelp When a dochelp string contains doctest code, the doctest code is not stripped, so the help also displays the doctest. Just stop parsing dochelp at the first hint of a doctest section (starting with >>>). Signed-off-by: "Yann E. MORIN" diff -r 0d175ac527c1 -r 684864d54903 mercurial/help.py --- a/mercurial/help.py Mon Mar 12 13:37:39 2012 -0500 +++ b/mercurial/help.py Fri Mar 09 22:54:17 2012 +0100 @@ -94,8 +94,13 @@ continue text = gettext(text) lines = text.splitlines() - lines[1:] = [(' ' + l.strip()) for l in lines[1:]] - entries.append('\n'.join(lines)) + doclines = [(lines[0])] + for l in lines[1:]: + # Stop once we find some Python doctest + if l.strip().startswith('>>>'): + break + doclines.append(' ' + l.strip()) + entries.append('\n'.join(doclines)) entries = '\n\n'.join(entries) return doc.replace(marker, entries)