[PATCH 1 of 3 V2] help: strip doctests from __doc__ texts

Adrian Buehlmann adrian at cadifra.com
Mon Apr 18 04:39:18 CDT 2011


# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1303117190 -7200
# Node ID 0880f030b54e20ad0ea11107011066a82b7f4301
# Parent  3c2f9f611ef6cc80157f3066045eccefce5a4f55
help: strip doctests from __doc__ texts

diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -123,6 +123,9 @@
     entries = []
     for name in sorted(items):
         text = (items[name].__doc__ or '').rstrip()
+        f = text.find('    >>>') # remove doctests
+        if f != -1:
+            text = text[:f].rstrip()
         if not text:
             continue
         text = gettext(text)


More information about the Mercurial-devel mailing list