Show More
@@ -8,6 +8,7 from mercurial import ( | |||
|
8 | 8 | encoding, |
|
9 | 9 | rcutil, |
|
10 | 10 | ui as uimod, |
|
11 | util, | |
|
11 | 12 | ) |
|
12 | 13 | |
|
13 | 14 | testtmp = encoding.environ['TESTTMP'] |
@@ -40,7 +41,7 def printconfigs(env): | |||
|
40 | 41 | ui = uimod.ui.load() |
|
41 | 42 | for section, name, value in ui.walkconfig(): |
|
42 | 43 | source = ui.configsource(section, name) |
|
43 | print('%s.%s=%s # %s' % (section, name, value, source)) | |
|
44 | print('%s.%s=%s # %s' % (section, name, value, util.pconvert(source))) | |
|
44 | 45 | print('') |
|
45 | 46 | |
|
46 | 47 | # environment variable overrides |
@@ -74,14 +74,14 def testui(user='foo', group='bar', tuse | |||
|
74 | 74 | return u |
|
75 | 75 | print('trusted') |
|
76 | 76 | for name, path in u.configitems('paths'): |
|
77 | print(' ', name, '=', path) | |
|
77 | print(' ', name, '=', util.pconvert(path)) | |
|
78 | 78 | print('untrusted') |
|
79 | 79 | for name, path in u.configitems('paths', untrusted=True): |
|
80 | 80 | print('.', end=' ') |
|
81 | 81 | u.config('paths', name) # warning with debug=True |
|
82 | 82 | print('.', end=' ') |
|
83 | 83 | u.config('paths', name, untrusted=True) # no warnings |
|
84 | print(name, '=', path) | |
|
84 | print(name, '=', util.pconvert(path)) | |
|
85 | 85 | print() |
|
86 | 86 | |
|
87 | 87 | return u |
@@ -217,6 +217,12 bytes=81mb | |||
|
217 | 217 | list=spam,ham,eggs |
|
218 | 218 | ''') |
|
219 | 219 | u = testui(user='abc', group='def', cuser='foo', silent=True) |
|
220 | def configpath(section, name, default=None, untrusted=False): | |
|
221 | path = u.configpath(section, name, default, untrusted) | |
|
222 | if path is None: | |
|
223 | return None | |
|
224 | return util.pconvert(path) | |
|
225 | ||
|
220 | 226 | print('# suboptions, trusted and untrusted') |
|
221 | 227 | trusted = u.configsuboptions('foo', 'sub') |
|
222 | 228 | untrusted = u.configsuboptions('foo', 'sub', untrusted=True) |
@@ -224,7 +230,7 print( | |||
|
224 | 230 | (trusted[0], sorted(trusted[1].items())), |
|
225 | 231 | (untrusted[0], sorted(untrusted[1].items()))) |
|
226 | 232 | print('# path, trusted and untrusted') |
|
227 |
print( |
|
|
233 | print(configpath('foo', 'path'), configpath('foo', 'path', untrusted=True)) | |
|
228 | 234 | print('# bool, trusted and untrusted') |
|
229 | 235 | print(u.configbool('foo', 'bool'), u.configbool('foo', 'bool', untrusted=True)) |
|
230 | 236 | print('# int, trusted and untrusted') |
General Comments 0
You need to be logged in to leave comments.
Login now