Show More
@@ -1,109 +1,113 b'' | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | do_push() |
|
3 | do_push() | |
4 | { |
|
4 | { | |
5 | user=$1 |
|
5 | user=$1 | |
6 | shift |
|
6 | shift | |
7 |
|
7 | |||
8 | echo "Pushing as user $user" |
|
8 | echo "Pushing as user $user" | |
9 | echo 'hgrc = """' |
|
9 | echo 'hgrc = """' | |
10 | sed -e 1,2d b/.hg/hgrc |
|
10 | sed -e 1,2d b/.hg/hgrc | |
11 | echo '"""' |
|
11 | echo '"""' | |
12 | if test -f acl.config; then |
|
12 | if test -f acl.config; then | |
13 | echo 'acl.config = """' |
|
13 | echo 'acl.config = """' | |
14 | cat acl.config |
|
14 | cat acl.config | |
15 | echo '"""' |
|
15 | echo '"""' | |
16 | fi |
|
16 | fi | |
17 | LOGNAME=$user hg --cwd a --debug push ../b |
|
17 | # On AIX /etc/profile sets LOGNAME read-only. So | |
|
18 | # LOGNAME=$user hg --cws a --debug push ../b | |||
|
19 | # fails with "This variable is read only." | |||
|
20 | # Use env to work around this. | |||
|
21 | env LOGNAME=$user hg --cwd a --debug push ../b | |||
18 | hg --cwd b rollback |
|
22 | hg --cwd b rollback | |
19 | hg --cwd b --quiet tip |
|
23 | hg --cwd b --quiet tip | |
20 | echo |
|
24 | echo | |
21 | } |
|
25 | } | |
22 |
|
26 | |||
23 | hg init a |
|
27 | hg init a | |
24 | cd a |
|
28 | cd a | |
25 | mkdir foo foo/Bar quux |
|
29 | mkdir foo foo/Bar quux | |
26 | echo 'in foo' > foo/file.txt |
|
30 | echo 'in foo' > foo/file.txt | |
27 | echo 'in foo/Bar' > foo/Bar/file.txt |
|
31 | echo 'in foo/Bar' > foo/Bar/file.txt | |
28 | echo 'in quux' > quux/file.py |
|
32 | echo 'in quux' > quux/file.py | |
29 | hg add -q |
|
33 | hg add -q | |
30 | hg ci -m 'add files' -d '1000000 0' |
|
34 | hg ci -m 'add files' -d '1000000 0' | |
31 | echo >> foo/file.txt |
|
35 | echo >> foo/file.txt | |
32 | hg ci -m 'change foo/file' -d '1000001 0' |
|
36 | hg ci -m 'change foo/file' -d '1000001 0' | |
33 | echo >> foo/Bar/file.txt |
|
37 | echo >> foo/Bar/file.txt | |
34 | hg ci -m 'change foo/Bar/file' -d '1000002 0' |
|
38 | hg ci -m 'change foo/Bar/file' -d '1000002 0' | |
35 | echo >> quux/file.py |
|
39 | echo >> quux/file.py | |
36 | hg ci -m 'change quux/file' -d '1000003 0' |
|
40 | hg ci -m 'change quux/file' -d '1000003 0' | |
37 | hg tip --quiet |
|
41 | hg tip --quiet | |
38 |
|
42 | |||
39 | cd .. |
|
43 | cd .. | |
40 | hg clone -r 0 a b |
|
44 | hg clone -r 0 a b | |
41 |
|
45 | |||
42 | echo '[extensions]' >> $HGRCPATH |
|
46 | echo '[extensions]' >> $HGRCPATH | |
43 | echo 'hgext.acl =' >> $HGRCPATH |
|
47 | echo 'hgext.acl =' >> $HGRCPATH | |
44 |
|
48 | |||
45 | config=b/.hg/hgrc |
|
49 | config=b/.hg/hgrc | |
46 |
|
50 | |||
47 | echo |
|
51 | echo | |
48 |
|
52 | |||
49 | echo 'Extension disabled for lack of a hook' |
|
53 | echo 'Extension disabled for lack of a hook' | |
50 | do_push fred |
|
54 | do_push fred | |
51 |
|
55 | |||
52 | echo '[hooks]' >> $config |
|
56 | echo '[hooks]' >> $config | |
53 | echo 'pretxnchangegroup.acl = python:hgext.acl.hook' >> $config |
|
57 | echo 'pretxnchangegroup.acl = python:hgext.acl.hook' >> $config | |
54 |
|
58 | |||
55 | echo 'Extension disabled for lack of acl.sources' |
|
59 | echo 'Extension disabled for lack of acl.sources' | |
56 | do_push fred |
|
60 | do_push fred | |
57 |
|
61 | |||
58 | echo 'No [acl.allow]/[acl.deny]' |
|
62 | echo 'No [acl.allow]/[acl.deny]' | |
59 | echo '[acl]' >> $config |
|
63 | echo '[acl]' >> $config | |
60 | echo 'sources = push' >> $config |
|
64 | echo 'sources = push' >> $config | |
61 | do_push fred |
|
65 | do_push fred | |
62 |
|
66 | |||
63 | echo 'Empty [acl.allow]' |
|
67 | echo 'Empty [acl.allow]' | |
64 | echo '[acl.allow]' >> $config |
|
68 | echo '[acl.allow]' >> $config | |
65 | do_push fred |
|
69 | do_push fred | |
66 |
|
70 | |||
67 | echo 'fred is allowed inside foo/' |
|
71 | echo 'fred is allowed inside foo/' | |
68 | echo 'foo/** = fred' >> $config |
|
72 | echo 'foo/** = fred' >> $config | |
69 | do_push fred |
|
73 | do_push fred | |
70 |
|
74 | |||
71 | echo 'Empty [acl.deny]' |
|
75 | echo 'Empty [acl.deny]' | |
72 | echo '[acl.deny]' >> $config |
|
76 | echo '[acl.deny]' >> $config | |
73 | do_push barney |
|
77 | do_push barney | |
74 |
|
78 | |||
75 | echo 'fred is allowed inside foo/, but not foo/bar/ (case matters)' |
|
79 | echo 'fred is allowed inside foo/, but not foo/bar/ (case matters)' | |
76 | echo 'foo/bar/** = fred' >> $config |
|
80 | echo 'foo/bar/** = fred' >> $config | |
77 | do_push fred |
|
81 | do_push fred | |
78 |
|
82 | |||
79 | echo 'fred is allowed inside foo/, but not foo/Bar/' |
|
83 | echo 'fred is allowed inside foo/, but not foo/Bar/' | |
80 | echo 'foo/Bar/** = fred' >> $config |
|
84 | echo 'foo/Bar/** = fred' >> $config | |
81 | do_push fred |
|
85 | do_push fred | |
82 |
|
86 | |||
83 | echo 'barney is not mentioned => not allowed anywhere' |
|
87 | echo 'barney is not mentioned => not allowed anywhere' | |
84 | do_push barney |
|
88 | do_push barney | |
85 |
|
89 | |||
86 | echo 'barney is allowed everywhere' |
|
90 | echo 'barney is allowed everywhere' | |
87 | echo '[acl.allow]' >> $config |
|
91 | echo '[acl.allow]' >> $config | |
88 | echo '** = barney' >> $config |
|
92 | echo '** = barney' >> $config | |
89 | do_push barney |
|
93 | do_push barney | |
90 |
|
94 | |||
91 | echo 'wilma can change files with a .txt extension' |
|
95 | echo 'wilma can change files with a .txt extension' | |
92 | echo '**/*.txt = wilma' >> $config |
|
96 | echo '**/*.txt = wilma' >> $config | |
93 | do_push wilma |
|
97 | do_push wilma | |
94 |
|
98 | |||
95 | echo 'file specified by acl.config does not exist' |
|
99 | echo 'file specified by acl.config does not exist' | |
96 | echo '[acl]' >> $config |
|
100 | echo '[acl]' >> $config | |
97 | echo 'config = ../acl.config' >> $config |
|
101 | echo 'config = ../acl.config' >> $config | |
98 | do_push barney |
|
102 | do_push barney | |
99 |
|
103 | |||
100 | echo 'betty is allowed inside foo/ by a acl.config file' |
|
104 | echo 'betty is allowed inside foo/ by a acl.config file' | |
101 | echo '[acl.allow]' >> acl.config |
|
105 | echo '[acl.allow]' >> acl.config | |
102 | echo 'foo/** = betty' >> acl.config |
|
106 | echo 'foo/** = betty' >> acl.config | |
103 | do_push betty |
|
107 | do_push betty | |
104 |
|
108 | |||
105 | echo 'acl.config can set only [acl.allow]/[acl.deny]' |
|
109 | echo 'acl.config can set only [acl.allow]/[acl.deny]' | |
106 | echo '[hooks]' >> acl.config |
|
110 | echo '[hooks]' >> acl.config | |
107 | echo 'changegroup.acl = false' >> acl.config |
|
111 | echo 'changegroup.acl = false' >> acl.config | |
108 | do_push barney |
|
112 | do_push barney | |
109 |
|
113 |
General Comments 0
You need to be logged in to leave comments.
Login now