comparison tests/test-trusted.py @ 5523:5db730475d6d

tests/*: avoid losing the original settings from $HGRCPATH
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Fri, 09 Nov 2007 20:21:35 -0200
parents 96d8a56d4ef9
children 6b5522cb2ad2
comparison
equal deleted inserted replaced
5522:f5345a2d2391 5523:5db730475d6d
4 4
5 import os 5 import os
6 from mercurial import ui, util 6 from mercurial import ui, util
7 7
8 hgrc = os.environ['HGRCPATH'] 8 hgrc = os.environ['HGRCPATH']
9 f = open(hgrc)
10 basehgrc = f.read()
11 f.close()
9 12
10 def testui(user='foo', group='bar', tusers=(), tgroups=(), 13 def testui(user='foo', group='bar', tusers=(), tgroups=(),
11 cuser='foo', cgroup='bar', debug=False, silent=False): 14 cuser='foo', cgroup='bar', debug=False, silent=False):
12 # user, group => owners of the file 15 # user, group => owners of the file
13 # tusers, tgroups => trusted users/groups 16 # tusers, tgroups => trusted users/groups
14 # cuser, cgroup => user/group of the current process 17 # cuser, cgroup => user/group of the current process
15 18
16 # write a global hgrc with the list of trusted users/groups and 19 # write a global hgrc with the list of trusted users/groups and
17 # some setting so that we can be sure it was read 20 # some setting so that we can be sure it was read
18 f = open(hgrc, 'w') 21 f = open(hgrc, 'w')
19 f.write('[paths]\n') 22 f.write(basehgrc)
23 f.write('\n[paths]\n')
20 f.write('global = /some/path\n\n') 24 f.write('global = /some/path\n\n')
21 25
22 if tusers or tgroups: 26 if tusers or tgroups:
23 f.write('[trusted]\n') 27 f.write('[trusted]\n')
24 if tusers: 28 if tusers: