##// END OF EJS Templates
ui: report_untrusted fixes...
Matt Mackall -
r8204:797586be default
parent child Browse files
Show More
@@ -16,7 +16,7 b' class ui(object):'
16 16 def __init__(self, src=None):
17 17 self._buffers = []
18 18 self.quiet = self.verbose = self.debugflag = self.traceback = False
19 self.interactive = self.report_untrusted = True
19 self.interactive = self._reportuntrusted = True
20 20 self._ocfg = config.config() # overlay
21 21 self._tcfg = config.config() # trusted
22 22 self._ucfg = config.config() # untrusted
@@ -63,7 +63,7 b' class ui(object):'
63 63 if user in tusers or group in tgroups or user == util.username():
64 64 return True
65 65
66 if self.report_untrusted:
66 if self._reportuntrusted:
67 67 self.warn(_('Not trusting file %s from untrusted '
68 68 'user %s, group %s\n') % (f, user, group))
69 69 return False
@@ -111,7 +111,7 b' class ui(object):'
111 111 self.quiet = not self.debugflag and self.configbool('ui', 'quiet')
112 112 if self.verbose and self.quiet:
113 113 self.quiet = self.verbose = False
114 self.report_untrusted = self.configbool("ui", "report_untrusted", True)
114 self._reportuntrusted = self.configbool("ui", "report_untrusted", True)
115 115 self.interactive = self.configbool("ui", "interactive", self.isatty())
116 116 self.traceback = self.configbool('ui', 'traceback', False)
117 117
@@ -134,10 +134,10 b' class ui(object):'
134 134
135 135 def config(self, section, name, default=None, untrusted=False):
136 136 value = self._data(untrusted).get(section, name, default)
137 if self.debugflag and not untrusted:
137 if self.debugflag and not untrusted and self._reportuntrusted:
138 138 uvalue = self._ucfg.get(section, name)
139 139 if uvalue is not None and uvalue != value:
140 self.warn(_("Ignoring untrusted configuration option "
140 self.debug(_("ignoring untrusted configuration option "
141 141 "%s.%s = %s\n") % (section, name, uvalue))
142 142 return value
143 143
@@ -165,10 +165,10 b' class ui(object):'
165 165
166 166 def configitems(self, section, untrusted=False):
167 167 items = self._data(untrusted).items(section)
168 if self.debugflag and not untrusted:
168 if self.debugflag and not untrusted and self._reportuntrusted:
169 169 for k,v in self._ucfg.items(section):
170 170 if self._tcfg.get(section, k) != v:
171 self.warn(_("Ignoring untrusted configuration option "
171 self.debug(_("ignoring untrusted configuration option "
172 172 "%s.%s = %s\n") % (section, k, v))
173 173 return items
174 174
@@ -129,12 +129,12 b' untrusted'
129 129 # different user, different group
130 130 Not trusting file .hg/hgrc from untrusted user abc, group def
131 131 trusted
132 Ignoring untrusted configuration option paths.local = /another/path
132 ignoring untrusted configuration option paths.local = /another/path
133 133 global = /some/path
134 134 untrusted
135 135 . . global = /some/path
136 .Ignoring untrusted configuration option paths.local = /another/path
137 . local = /another/path
136 .ignoring untrusted configuration option paths.local = /another/path
137 . local = /another/path
138 138
139 139 # ui.readconfig sections
140 140 quux
@@ -142,7 +142,7 b' quux'
142 142 # read trusted, untrusted, new ui, trusted
143 143 Not trusting file foobar from untrusted user abc, group def
144 144 trusted:
145 Ignoring untrusted configuration option foobar.baz = quux
145 ignoring untrusted configuration option foobar.baz = quux
146 146 None
147 147 untrusted:
148 148 quux
General Comments 0
You need to be logged in to leave comments. Login now