[PATCH] commands: Check if helptext contains a newline before we split

David Soria Parra sn_ at gmx.net
Mon Jul 27 07:23:00 CDT 2009


# HG changeset patch
# User David Soria Parra <dsp at php.net>
# Date 1248653537 -7200
# Node ID b694531a5aa79348f44d1f39be856c4a3e356c93
# Parent  ca143d86727cdf7cfc079b6fc9a1eb09eed2dc72
commands: Check if helptext contains a newline before we split

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1555,7 +1555,10 @@
             raise error.UnknownCommand(name)
 
         doc = gettext(mod.__doc__) or _('no help text available')
-        head, tail = doc.split('\n', 1)
+        if '\n' not in doc:
+            head, tail = doc, ""
+        else:
+            head, tail = doc.split('\n', 1)
         ui.write(_('%s extension - %s\n\n') % (name.split('.')[-1], head))
         if tail:
             ui.write(minirst.format(tail, textwidth))


More information about the Mercurial-devel mailing list