[PATCH 2 of 7] help: inline helper function used once only
Olav Reinert
seroton10 at gmail.com
Sat May 26 10:43:47 CDT 2012
# HG changeset patch
# User Olav Reinert <seroton10 at gmail.com>
# Date 1337809351 -7200
# Node ID 25fccf8fd755f30c3d3347d135f37b097e10042c
# Parent 5699ef4b5bd06e8685dd598e01ed46bee56e8ddc
help: inline helper function used once only
diff -r 5699ef4b5bd0 -r 25fccf8fd755 mercurial/commands.py
--- a/mercurial/commands.py Wed May 23 20:55:57 2012 +0200
+++ b/mercurial/commands.py Wed May 23 23:42:31 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:
diff -r 5699ef4b5bd0 -r 25fccf8fd755 mercurial/help.py
--- a/mercurial/help.py Wed May 23 20:55:57 2012 +0200
+++ b/mercurial/help.py Wed May 23 23:42:31 2012 +0200
@@ -62,21 +62,6 @@
return '\n'.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.
More information about the Mercurial-devel
mailing list