ui: report_untrusted fixes
authorMatt Mackall <mpm@selenic.com>
Sun, 26 Apr 2009 16:50:44 -0500
changeset 8204 797586be575d
parent 8203 3377fa11af67
child 8205 00736cd2702a
ui: report_untrusted fixes - report_untrusted -> _reportuntrusted - only report config shadows if enabled - config shadows are debug messages
mercurial/ui.py
tests/test-trusted.py.out
--- a/mercurial/ui.py	Sun Apr 26 16:50:44 2009 -0500
+++ b/mercurial/ui.py	Sun Apr 26 16:50:44 2009 -0500
@@ -16,7 +16,7 @@
     def __init__(self, src=None):
         self._buffers = []
         self.quiet = self.verbose = self.debugflag = self.traceback = False
-        self.interactive = self.report_untrusted = True
+        self.interactive = self._reportuntrusted = True
         self._ocfg = config.config() # overlay
         self._tcfg = config.config() # trusted
         self._ucfg = config.config() # untrusted
@@ -63,7 +63,7 @@
         if user in tusers or group in tgroups or user == util.username():
             return True
 
-        if self.report_untrusted:
+        if self._reportuntrusted:
             self.warn(_('Not trusting file %s from untrusted '
                         'user %s, group %s\n') % (f, user, group))
         return False
@@ -111,7 +111,7 @@
         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._reportuntrusted = self.configbool("ui", "report_untrusted", True)
         self.interactive = self.configbool("ui", "interactive", self.isatty())
         self.traceback = self.configbool('ui', 'traceback', False)
 
@@ -134,10 +134,10 @@
 
     def config(self, section, name, default=None, untrusted=False):
         value = self._data(untrusted).get(section, name, default)
-        if self.debugflag and not untrusted:
+        if self.debugflag and not untrusted and self._reportuntrusted:
             uvalue = self._ucfg.get(section, name)
             if uvalue is not None and uvalue != value:
-                self.warn(_("Ignoring untrusted configuration option "
+                self.debug(_("ignoring untrusted configuration option "
                             "%s.%s = %s\n") % (section, name, uvalue))
         return value
 
@@ -165,10 +165,10 @@
 
     def configitems(self, section, untrusted=False):
         items = self._data(untrusted).items(section)
-        if self.debugflag and not untrusted:
+        if self.debugflag and not untrusted and self._reportuntrusted:
             for k,v in self._ucfg.items(section):
                 if self._tcfg.get(section, k) != v:
-                    self.warn(_("Ignoring untrusted configuration option "
+                    self.debug(_("ignoring untrusted configuration option "
                                 "%s.%s = %s\n") % (section, k, v))
         return items
 
--- a/tests/test-trusted.py.out	Sun Apr 26 16:50:44 2009 -0500
+++ b/tests/test-trusted.py.out	Sun Apr 26 16:50:44 2009 -0500
@@ -129,12 +129,12 @@
 # different user, different group
 Not trusting file .hg/hgrc from untrusted user abc, group def
 trusted
-Ignoring untrusted configuration option paths.local = /another/path
+ignoring untrusted configuration option paths.local = /another/path
     global = /some/path
 untrusted
 . . global = /some/path
-.Ignoring untrusted configuration option paths.local = /another/path
- . local = /another/path
+.ignoring untrusted configuration option paths.local = /another/path
+. local = /another/path
 
 # ui.readconfig sections
 quux
@@ -142,7 +142,7 @@
 # read trusted, untrusted, new ui, trusted
 Not trusting file foobar from untrusted user abc, group def
 trusted:
-Ignoring untrusted configuration option foobar.baz = quux
+ignoring untrusted configuration option foobar.baz = quux
 None
 untrusted:
 quux