changeset 16817:946800b43533

help: format topic help using RST
author Olav Reinert <seroton10@gmail.com>
date Fri, 01 Jun 2012 12:15:45 +0200
parents d10994f1c7a2
children d0fc1e689227
files mercurial/commands.py
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Fri Jun 01 12:01:33 2012 +0200
+++ b/mercurial/commands.py	Fri Jun 01 12:15:45 2012 +0200
@@ -3268,20 +3268,20 @@
         else:
             raise error.UnknownCommand(name)
 
+        rst = ["%s\n\n" % header]
         # description
         if not doc:
-            doc = _("(no help text available)")
+            rst.append("    %s\n" % _("(no help text available)"))
         if util.safehasattr(doc, '__call__'):
-            doc = doc()
-
-        ui.write("%s\n\n" % header)
-        ui.write(minirst.format(doc, textwidth, indent=4))
+            rst += ["    %s\n" % l for l in doc().splitlines()]
+
         try:
             cmdutil.findcmd(name, table)
-            ui.write(_('\nuse "hg help -c %s" to see help for '
+            rst.append(_('\nuse "hg help -c %s" to see help for '
                        'the %s command\n') % (name, name))
         except error.UnknownCommand:
             pass
+        ui.write(minirst.format(''.join(rst), textwidth))
 
     def helpext(name):
         try: