Show More
@@ -122,8 +122,8 b' class ui(object):' | |||||
122 | self.quiet = not self.debugflag and self.configbool('ui', 'quiet') |
|
122 | self.quiet = not self.debugflag and self.configbool('ui', 'quiet') | |
123 | if self.verbose and self.quiet: |
|
123 | if self.verbose and self.quiet: | |
124 | self.quiet = self.verbose = False |
|
124 | self.quiet = self.verbose = False | |
125 |
self._reportuntrusted = self.configbool("ui", |
|
125 | self._reportuntrusted = self.debugflag or self.configbool("ui", | |
126 | True) |
|
126 | "report_untrusted", True) | |
127 | self.tracebackflag = self.configbool('ui', 'traceback', False) |
|
127 | self.tracebackflag = self.configbool('ui', 'traceback', False) | |
128 |
|
128 | |||
129 | if section in (None, 'trusted'): |
|
129 | if section in (None, 'trusted'): |
@@ -11,7 +11,8 b' basehgrc = f.read()' | |||||
11 | f.close() |
|
11 | f.close() | |
12 |
|
12 | |||
13 | def testui(user='foo', group='bar', tusers=(), tgroups=(), |
|
13 | def testui(user='foo', group='bar', tusers=(), tgroups=(), | |
14 |
cuser='foo', cgroup='bar', debug=False, silent=False |
|
14 | cuser='foo', cgroup='bar', debug=False, silent=False, | |
|
15 | report=True): | |||
15 | # user, group => owners of the file |
|
16 | # user, group => owners of the file | |
16 | # tusers, tgroups => trusted users/groups |
|
17 | # tusers, tgroups => trusted users/groups | |
17 | # cuser, cgroup => user/group of the current process |
|
18 | # cuser, cgroup => user/group of the current process | |
@@ -61,6 +62,7 b" def testui(user='foo', group='bar', tuse" | |||||
61 |
|
62 | |||
62 | u = ui.ui() |
|
63 | u = ui.ui() | |
63 | u.setconfig('ui', 'debug', str(bool(debug))) |
|
64 | u.setconfig('ui', 'debug', str(bool(debug))) | |
|
65 | u.setconfig('ui', 'report_untrusted', str(bool(report))) | |||
64 | u.readconfig('.hg/hgrc') |
|
66 | u.readconfig('.hg/hgrc') | |
65 | if silent: |
|
67 | if silent: | |
66 | return u |
|
68 | return u | |
@@ -131,6 +133,12 b" testui(user='abc', group='def', cuser=No" | |||||
131 | print "# prints debug warnings" |
|
133 | print "# prints debug warnings" | |
132 | u = testui(user='abc', group='def', cuser='foo', debug=True) |
|
134 | u = testui(user='abc', group='def', cuser='foo', debug=True) | |
133 |
|
135 | |||
|
136 | print "# report_untrusted enabled without debug hides warnings" | |||
|
137 | u = testui(user='abc', group='def', cuser='foo', report=False) | |||
|
138 | ||||
|
139 | print "# report_untrusted enabled with debug shows warnings" | |||
|
140 | u = testui(user='abc', group='def', cuser='foo', debug=True, report=False) | |||
|
141 | ||||
134 | print "# ui.readconfig sections" |
|
142 | print "# ui.readconfig sections" | |
135 | filename = 'foobar' |
|
143 | filename = 'foobar' | |
136 | f = open(filename, 'w') |
|
144 | f = open(filename, 'w') |
@@ -136,6 +136,25 b' untrusted' | |||||
136 | .ignoring untrusted configuration option paths.local = /another/path |
|
136 | .ignoring untrusted configuration option paths.local = /another/path | |
137 | . local = /another/path |
|
137 | . local = /another/path | |
138 |
|
138 | |||
|
139 | # report_untrusted enabled without debug hides warnings | |||
|
140 | # different user, different group | |||
|
141 | trusted | |||
|
142 | global = /some/path | |||
|
143 | untrusted | |||
|
144 | . . global = /some/path | |||
|
145 | . . local = /another/path | |||
|
146 | ||||
|
147 | # report_untrusted enabled with debug shows warnings | |||
|
148 | # different user, different group | |||
|
149 | Not trusting file .hg/hgrc from untrusted user abc, group def | |||
|
150 | trusted | |||
|
151 | ignoring untrusted configuration option paths.local = /another/path | |||
|
152 | global = /some/path | |||
|
153 | untrusted | |||
|
154 | . . global = /some/path | |||
|
155 | .ignoring untrusted configuration option paths.local = /another/path | |||
|
156 | . local = /another/path | |||
|
157 | ||||
139 | # ui.readconfig sections |
|
158 | # ui.readconfig sections | |
140 | quux |
|
159 | quux | |
141 |
|
160 |
General Comments 0
You need to be logged in to leave comments.
Login now