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