changeset 8138:0ffb8f791b7c

ui: fold verbosity_constraints into fixconfig, simplify
author Matt Mackall <mpm@selenic.com>
date Thu, 23 Apr 2009 15:40:10 -0500
parents 7fd0616b3d80
children 9302404b60f3
files mercurial/ui.py
diffstat 1 files changed, 11 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/ui.py	Thu Apr 23 15:40:10 2009 -0500
+++ b/mercurial/ui.py	Thu Apr 23 15:40:10 2009 -0500
@@ -66,17 +66,6 @@
                 ui._isatty = False
         return ui._isatty
 
-    def verbosity_constraints(self):
-        self.quiet = self.configbool('ui', 'quiet')
-        self.verbose = self.configbool('ui', 'verbose')
-        self.debugflag = self.configbool('ui', 'debug')
-
-        if self.debugflag:
-            self.verbose = True
-            self.quiet = False
-        elif self.verbose and self.quiet:
-            self.quiet = self.verbose = False
-
     def _is_trusted(self, fp, f, warn=True):
         st = util.fstat(fp)
         if util.isowner(fp, st):
@@ -183,19 +172,18 @@
                         cdata.set("paths", n,
                                   os.path.normpath(os.path.join(root, path)))
 
-        # update verbosity/interactive/report_untrusted settings
+        # update ui options
         if section is None or section == 'ui':
-            if name is None or name in ('quiet', 'verbose', 'debug'):
-                self.verbosity_constraints()
-            if name is None or name == 'interactive':
-                interactive = self.configbool("ui", "interactive", None)
-                if interactive is None and self.interactive:
-                    self.interactive = self.isatty()
-                else:
-                    self.interactive = interactive
-            if name is None or name == 'report_untrusted':
-                self.report_untrusted = (
-                    self.configbool("ui", "report_untrusted", True))
+            self.debugflag = self.configbool('ui', 'debug')
+            self.verbose = self.debugflag or self.configbool('ui', 'verbose')
+            self.quiet = not self.debugflag and self.configbool('ui', 'quiet')
+            if self.verbose and self.quiet:
+                self.quiet = self.verbose = False
+
+            self.report_untrusted = self.configbool("ui", "report_untrusted",
+                                                    True)
+            self.interactive = self.configbool("ui", "interactive",
+                                               self.isatty())
             self.traceback = self.configbool('ui', 'traceback', False)
 
         # update trust information