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

David Soria Parra sn_ at gmx.net
Sun Jul 26 19:14:49 CDT 2009


# HG changeset patch
# User David Soria Parra <dsp at php.net>
# Date 1248653537 -7200
# Node ID 1f5fa2fbbc6a5771f2058c0a596d9e0f2bb8187a
# Parent  d98cef25b5afed5d8aa325ef87f98789367d8b6e
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
@@ -1533,7 +1533,10 @@
             raise error.UnknownCommand(name)
 
         doc = gettext(mod.__doc__) or _('no help text available')
-        head, tail = doc.split('\n', 1)
+        if doc.count('\n') == 0:
+            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