comparison tests/test-config-env.py @ 51700:7f0cb9ee0534

Backout accidental publication of a large range of revisions I accidentally published 25e7f9dcad0f::bd1483fd7088, this is the inverse.
author Raphaël Gomès <rgomes@octobus.net>
date Tue, 23 Jul 2024 10:02:46 +0200
parents 493034cc3265
children ca7bde5dbafb
comparison
equal deleted inserted replaced
51699:bd1483fd7088 51700:7f0cb9ee0534
13 13
14 from mercurial.utils import procutil 14 from mercurial.utils import procutil
15 15
16 testtmp = encoding.environ[b'TESTTMP'] 16 testtmp = encoding.environ[b'TESTTMP']
17 17
18
19 # prepare hgrc files 18 # prepare hgrc files
20 def join(name): 19 def join(name):
21 return os.path.join(testtmp, name) 20 return os.path.join(testtmp, name)
22 21
23 22
24 with open(join(b'sysrc'), 'wb') as f: 23 with open(join(b'sysrc'), 'wb') as f:
25 f.write(b'[ui]\neditor=e0\n[pager]\npager=p0\n') 24 f.write(b'[ui]\neditor=e0\n[pager]\npager=p0\n')
26 25
27 with open(join(b'userrc'), 'wb') as f: 26 with open(join(b'userrc'), 'wb') as f:
28 f.write(b'[ui]\neditor=e1') 27 f.write(b'[ui]\neditor=e1')
29
30 28
31 # replace rcpath functions so they point to the files above 29 # replace rcpath functions so they point to the files above
32 def systemrcpath(): 30 def systemrcpath():
33 return [join(b'sysrc')] 31 return [join(b'sysrc')]
34 32
39 37
40 extensions.wrapfunction(rcutil, 'default_rc_resources', lambda orig: []) 38 extensions.wrapfunction(rcutil, 'default_rc_resources', lambda orig: [])
41 39
42 rcutil.systemrcpath = systemrcpath 40 rcutil.systemrcpath = systemrcpath
43 rcutil.userrcpath = userrcpath 41 rcutil.userrcpath = userrcpath
44
45 42
46 # utility to print configs 43 # utility to print configs
47 def printconfigs(env): 44 def printconfigs(env):
48 encoding.environ = env 45 encoding.environ = env
49 rcutil._rccomponents = None # reset cache 46 rcutil._rccomponents = None # reset cache