ui: kill check_trusted
authorMatt Mackall <mpm@selenic.com>
Thu, 23 Apr 2009 15:40:10 -0500
changeset 8133 57a2a0070d6b
parent 8132 cece135ffcf0
child 8134 e74e0c259bd3
ui: kill check_trusted
mercurial/ui.py
--- a/mercurial/ui.py	Thu Apr 23 15:40:10 2009 -0500
+++ b/mercurial/ui.py	Thu Apr 23 15:40:10 2009 -0500
@@ -44,9 +44,7 @@
             self.cdata = util.configparser()
             self.ucdata = None
             # we always trust global config files
-            self.check_trusted = False
-            self.readconfig(util.rcpath())
-            self.check_trusted = True
+            self.readconfig(util.rcpath(), assumetrusted=True)
             self.updateopts(verbose, debug, quiet, interactive)
         else:
             # parentui may point to an ui object which is already a child
@@ -103,8 +101,6 @@
             self.quiet = self.verbose = False
 
     def _is_trusted(self, fp, f, warn=True):
-        if not self.check_trusted:
-            return True
         st = util.fstat(fp)
         if util.isowner(fp, st):
             return True
@@ -125,7 +121,7 @@
                 return False
         return True
 
-    def readconfig(self, fn, root=None):
+    def readconfig(self, fn, root=None, assumetrusted=False):
         if isinstance(fn, basestring):
             fn = [fn]
         for f in fn:
@@ -134,7 +130,7 @@
             except IOError:
                 continue
             cdata = self.cdata
-            trusted = self._is_trusted(fp, f)
+            trusted = assumetrusted or self._is_trusted(fp, f)
             if not trusted:
                 if self.ucdata is None:
                     self.ucdata = dupconfig(self.cdata)