help: format topic help using RST
authorOlav Reinert <seroton10@gmail.com>
Fri, 01 Jun 2012 12:15:45 +0200
changeset 16817 946800b43533
parent 16816 d10994f1c7a2
child 16818 d0fc1e689227
help: format topic help using RST
mercurial/commands.py
--- 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: