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: |