changeset 8133:57a2a0070d6b

ui: kill check_trusted
author Matt Mackall <mpm@selenic.com>
date Thu, 23 Apr 2009 15:40:10 -0500
parents cece135ffcf0
children e74e0c259bd3
files mercurial/ui.py
diffstat 1 files changed, 3 insertions(+), 7 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
@@ -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)