changeset 16816:d10994f1c7a2

help: inline helper function used once only
author Olav Reinert <seroton10@gmail.com>
date Fri, 01 Jun 2012 12:01:33 +0200
parents e740746ea557
children 946800b43533
files mercurial/commands.py mercurial/help.py
diffstat 2 files changed, 11 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Fri Jun 01 11:58:23 2012 +0200
+++ b/mercurial/commands.py	Fri Jun 01 12:01:33 2012 +0200
@@ -3249,7 +3249,17 @@
                             'global options') % (name and " " + name or "")
                 optlist.append((msg, ()))
 
-        ui.write(help.opttext(optlist, textwidth, ui.verbose))
+        if not optlist:
+            return
+
+        rst = ''
+        for title, options in optlist:
+            rst += '\n%s\n' % title
+            if options:
+                rst += "\n"
+                rst += help.optrst(options, ui.verbose)
+                rst += '\n'
+        ui.write('\n' + minirst.format(rst, textwidth))
 
     def helptopic(name):
         for names, header, doc in help.helptable:
--- a/mercurial/help.py	Fri Jun 01 11:58:23 2012 +0200
+++ b/mercurial/help.py	Fri Jun 01 12:01:33 2012 +0200
@@ -62,21 +62,6 @@
 
     return ''.join(rst)
 
-# list all option lists
-def opttext(optlist, width, verbose):
-    rst = ''
-    if not optlist:
-        return ''
-
-    for title, options in optlist:
-        rst += '\n%s\n' % title
-        if options:
-            rst += "\n"
-            rst += optrst(options, verbose)
-            rst += '\n'
-
-    return '\n' + minirst.format(rst, width)
-
 def topicmatch(kw):
     """Return help topics matching kw.