author | Brodie Rao <me+hg@dackz.net> |
Mon, 10 Aug 2009 22:59:29 +0200 | |
changeset 9330 | be2a13153372 |
parent 7512 | 0d488f7f321d |
child 10119 | bb5ea66789e3 |
permissions | -rwxr-xr-x |
3426
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
1 |
#!/bin/sh |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
2 |
|
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
3 |
do_push() |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
4 |
{ |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
5 |
user=$1 |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
6 |
shift |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
7 |
|
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
8 |
echo "Pushing as user $user" |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
9 |
echo 'hgrc = """' |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
10 |
sed -e 1,2d b/.hg/hgrc |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
11 |
echo '"""' |
3469
33b6c8193652
Don't use test -e in tests - sh doesn't like it on Solaris
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3436
diff
changeset
|
12 |
if test -f acl.config; then |
3426
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
13 |
echo 'acl.config = """' |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
14 |
cat acl.config |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
15 |
echo '"""' |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
16 |
fi |
7512
0d488f7f321d
Fix test-acl failure on AIX due to read only LOGNAME.
Jim Hague <jim.hague@acm.org>
parents:
4138
diff
changeset
|
17 |
# On AIX /etc/profile sets LOGNAME read-only. So |
0d488f7f321d
Fix test-acl failure on AIX due to read only LOGNAME.
Jim Hague <jim.hague@acm.org>
parents:
4138
diff
changeset
|
18 |
# LOGNAME=$user hg --cws a --debug push ../b |
0d488f7f321d
Fix test-acl failure on AIX due to read only LOGNAME.
Jim Hague <jim.hague@acm.org>
parents:
4138
diff
changeset
|
19 |
# fails with "This variable is read only." |
0d488f7f321d
Fix test-acl failure on AIX due to read only LOGNAME.
Jim Hague <jim.hague@acm.org>
parents:
4138
diff
changeset
|
20 |
# Use env to work around this. |
0d488f7f321d
Fix test-acl failure on AIX due to read only LOGNAME.
Jim Hague <jim.hague@acm.org>
parents:
4138
diff
changeset
|
21 |
env LOGNAME=$user hg --cwd a --debug push ../b |
3426
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
22 |
hg --cwd b rollback |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
23 |
hg --cwd b --quiet tip |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
24 |
echo |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
25 |
} |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
26 |
|
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
27 |
hg init a |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
28 |
cd a |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
29 |
mkdir foo foo/Bar quux |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
30 |
echo 'in foo' > foo/file.txt |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
31 |
echo 'in foo/Bar' > foo/Bar/file.txt |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
32 |
echo 'in quux' > quux/file.py |
4138
85237110c371
make test-acl a bit more digestable for windows
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3469
diff
changeset
|
33 |
hg add -q |
3426
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
34 |
hg ci -m 'add files' -d '1000000 0' |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
35 |
echo >> foo/file.txt |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
36 |
hg ci -m 'change foo/file' -d '1000001 0' |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
37 |
echo >> foo/Bar/file.txt |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
38 |
hg ci -m 'change foo/Bar/file' -d '1000002 0' |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
39 |
echo >> quux/file.py |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
40 |
hg ci -m 'change quux/file' -d '1000003 0' |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
41 |
hg tip --quiet |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
42 |
|
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
43 |
cd .. |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
44 |
hg clone -r 0 a b |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
45 |
|
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
46 |
echo '[extensions]' >> $HGRCPATH |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
47 |
echo 'hgext.acl =' >> $HGRCPATH |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
48 |
|
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
49 |
config=b/.hg/hgrc |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
50 |
|
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
51 |
echo |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
52 |
|
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
53 |
echo 'Extension disabled for lack of a hook' |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
54 |
do_push fred |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
55 |
|
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
56 |
echo '[hooks]' >> $config |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
57 |
echo 'pretxnchangegroup.acl = python:hgext.acl.hook' >> $config |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
58 |
|
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
59 |
echo 'Extension disabled for lack of acl.sources' |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
60 |
do_push fred |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
61 |
|
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
62 |
echo 'No [acl.allow]/[acl.deny]' |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
63 |
echo '[acl]' >> $config |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
64 |
echo 'sources = push' >> $config |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
65 |
do_push fred |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
66 |
|
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
67 |
echo 'Empty [acl.allow]' |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
68 |
echo '[acl.allow]' >> $config |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
69 |
do_push fred |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
70 |
|
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
71 |
echo 'fred is allowed inside foo/' |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
72 |
echo 'foo/** = fred' >> $config |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
73 |
do_push fred |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
74 |
|
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
75 |
echo 'Empty [acl.deny]' |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
76 |
echo '[acl.deny]' >> $config |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
77 |
do_push barney |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
78 |
|
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
79 |
echo 'fred is allowed inside foo/, but not foo/bar/ (case matters)' |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
80 |
echo 'foo/bar/** = fred' >> $config |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
81 |
do_push fred |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
82 |
|
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
83 |
echo 'fred is allowed inside foo/, but not foo/Bar/' |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
84 |
echo 'foo/Bar/** = fred' >> $config |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
85 |
do_push fred |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
86 |
|
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
87 |
echo 'barney is not mentioned => not allowed anywhere' |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
88 |
do_push barney |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
89 |
|
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
90 |
echo 'barney is allowed everywhere' |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
91 |
echo '[acl.allow]' >> $config |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
92 |
echo '** = barney' >> $config |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
93 |
do_push barney |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
94 |
|
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
95 |
echo 'wilma can change files with a .txt extension' |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
96 |
echo '**/*.txt = wilma' >> $config |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
97 |
do_push wilma |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
98 |
|
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
99 |
echo 'file specified by acl.config does not exist' |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
100 |
echo '[acl]' >> $config |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
101 |
echo 'config = ../acl.config' >> $config |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
102 |
do_push barney |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
103 |
|
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
104 |
echo 'betty is allowed inside foo/ by a acl.config file' |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
105 |
echo '[acl.allow]' >> acl.config |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
106 |
echo 'foo/** = betty' >> acl.config |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
107 |
do_push betty |
bb00a5a92c30
Add a test for the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
108 |
|
3436
f29989e9746e
use ui.readsections in the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3426
diff
changeset
|
109 |
echo 'acl.config can set only [acl.allow]/[acl.deny]' |
f29989e9746e
use ui.readsections in the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3426
diff
changeset
|
110 |
echo '[hooks]' >> acl.config |
f29989e9746e
use ui.readsections in the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3426
diff
changeset
|
111 |
echo 'changegroup.acl = false' >> acl.config |
f29989e9746e
use ui.readsections in the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3426
diff
changeset
|
112 |
do_push barney |
f29989e9746e
use ui.readsections in the acl extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3426
diff
changeset
|
113 |