changeset 16780:d064da05590d

help: remove dependency on ui from some helper functions
author Olav Reinert <seroton10@gmail.com>
date Tue, 22 May 2012 22:08:41 +0200
parents 67bfe7f64e57
children c0b98f436cce
files mercurial/commands.py
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Mon May 21 16:19:30 2012 -0700
+++ b/mercurial/commands.py	Tue May 22 22:08:41 2012 +0200
@@ -3089,7 +3089,7 @@
 
     textwidth = min(ui.termwidth(), 80) - 2
 
-    def optrst(options):
+    def optrst(options, verbose):
         data = []
         multioccur = False
         for option in options:
@@ -3099,7 +3099,7 @@
                 shortopt, longopt, default, desc = option
                 optlabel = _("VALUE") # default label
 
-            if _("DEPRECATED") in desc and not ui.verbose:
+            if _("DEPRECATED") in desc and not verbose:
                 continue
 
             so = ''
@@ -3125,7 +3125,7 @@
         return rst
 
     # list all option lists
-    def opttext(optlist, width):
+    def opttext(optlist, width, verbose):
         rst = ''
         if not optlist:
             return ''
@@ -3134,7 +3134,7 @@
             rst += '\n%s\n' % title
             if options:
                 rst += "\n"
-                rst += optrst(options)
+                rst += optrst(options, verbose)
                 rst += '\n'
 
         return '\n' + minirst.format(rst, width)
@@ -3223,13 +3223,13 @@
             rst += '\n'
             rst += _("options:")
             rst += '\n\n'
-            rst += optrst(entry[1])
+            rst += optrst(entry[1], ui.verbose)
 
         if ui.verbose:
             rst += '\n'
             rst += _("global options:")
             rst += '\n\n'
-            rst += optrst(globalopts)
+            rst += optrst(globalopts, ui.verbose)
 
         keep = ui.verbose and ['verbose'] or []
         formatted, pruned = minirst.format(rst, textwidth, keep=keep)
@@ -3304,7 +3304,7 @@
 
         optlist = []
         addglobalopts(optlist, True)
-        ui.write(opttext(optlist, textwidth))
+        ui.write(opttext(optlist, textwidth, ui.verbose))
 
     def helptopic(name):
         for names, header, doc in help.helptable: