Show More
@@ -0,0 +1,19 b'' | |||||
|
1 | # Disable the $CAP wire protocol capability. | |||
|
2 | ||||
|
3 | if test -z "$CAP" | |||
|
4 | then | |||
|
5 | echo "CAP environment variable not set." | |||
|
6 | fi | |||
|
7 | ||||
|
8 | cat > notcapable-$CAP.py << EOF | |||
|
9 | from mercurial import extensions, repo | |||
|
10 | def extsetup(): | |||
|
11 | extensions.wrapfunction(repo.repository, 'capable', wrapper) | |||
|
12 | def wrapper(orig, self, name, *args, **kwargs): | |||
|
13 | if name == '$CAP': | |||
|
14 | return False | |||
|
15 | return orig(self, name, *args, **kwargs) | |||
|
16 | EOF | |||
|
17 | ||||
|
18 | echo '[extensions]' >> $HGRCPATH | |||
|
19 | echo "notcapable-$CAP = `pwd`/notcapable-$CAP.py" >> $HGRCPATH |
@@ -1,113 +1,104 b'' | |||||
1 |
|
1 | |||
2 | $ hg init test |
|
2 | $ hg init test | |
3 | $ cd test |
|
3 | $ cd test | |
4 | $ echo a > a |
|
4 | $ echo a > a | |
5 | $ hg ci -Ama |
|
5 | $ hg ci -Ama | |
6 | adding a |
|
6 | adding a | |
7 | $ cd .. |
|
7 | $ cd .. | |
8 | $ hg clone test test2 |
|
8 | $ hg clone test test2 | |
9 | updating to branch default |
|
9 | updating to branch default | |
10 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
10 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
11 | $ cd test2 |
|
11 | $ cd test2 | |
12 | $ echo a >> a |
|
12 | $ echo a >> a | |
13 | $ hg ci -mb |
|
13 | $ hg ci -mb | |
14 | $ req() { |
|
14 | $ req() { | |
15 | > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log |
|
15 | > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log | |
16 | > cat hg.pid >> $DAEMON_PIDS |
|
16 | > cat hg.pid >> $DAEMON_PIDS | |
17 | > hg --cwd ../test2 push http://localhost:$HGPORT/ |
|
17 | > hg --cwd ../test2 push http://localhost:$HGPORT/ | |
18 | > "$TESTDIR/killdaemons.py" |
|
18 | > "$TESTDIR/killdaemons.py" | |
19 | > echo % serve errors |
|
19 | > echo % serve errors | |
20 | > cat errors.log |
|
20 | > cat errors.log | |
21 | > } |
|
21 | > } | |
22 | $ cd ../test |
|
22 | $ cd ../test | |
23 |
|
23 | |||
24 | expect ssl error |
|
24 | expect ssl error | |
25 |
|
25 | |||
26 | $ req |
|
26 | $ req | |
27 | pushing to http://localhost:$HGPORT/ |
|
27 | pushing to http://localhost:$HGPORT/ | |
28 | searching for changes |
|
28 | searching for changes | |
29 | remote: ssl required |
|
29 | remote: ssl required | |
30 | % serve errors |
|
30 | % serve errors | |
31 |
|
31 | |||
32 | expect authorization error |
|
32 | expect authorization error | |
33 |
|
33 | |||
34 | $ echo '[web]' > .hg/hgrc |
|
34 | $ echo '[web]' > .hg/hgrc | |
35 | $ echo 'push_ssl = false' >> .hg/hgrc |
|
35 | $ echo 'push_ssl = false' >> .hg/hgrc | |
36 | $ req |
|
36 | $ req | |
37 | pushing to http://localhost:$HGPORT/ |
|
37 | pushing to http://localhost:$HGPORT/ | |
38 | searching for changes |
|
38 | searching for changes | |
39 | abort: authorization failed |
|
39 | abort: authorization failed | |
40 | % serve errors |
|
40 | % serve errors | |
41 |
|
41 | |||
42 | expect authorization error: must have authorized user |
|
42 | expect authorization error: must have authorized user | |
43 |
|
43 | |||
44 | $ echo 'allow_push = unperson' >> .hg/hgrc |
|
44 | $ echo 'allow_push = unperson' >> .hg/hgrc | |
45 | $ req |
|
45 | $ req | |
46 | pushing to http://localhost:$HGPORT/ |
|
46 | pushing to http://localhost:$HGPORT/ | |
47 | searching for changes |
|
47 | searching for changes | |
48 | abort: authorization failed |
|
48 | abort: authorization failed | |
49 | % serve errors |
|
49 | % serve errors | |
50 |
|
50 | |||
51 | expect success |
|
51 | expect success | |
52 |
|
52 | |||
53 | $ echo 'allow_push = *' >> .hg/hgrc |
|
53 | $ echo 'allow_push = *' >> .hg/hgrc | |
54 | $ echo '[hooks]' >> .hg/hgrc |
|
54 | $ echo '[hooks]' >> .hg/hgrc | |
55 | $ echo 'changegroup = python "$TESTDIR"/printenv.py changegroup 0' >> .hg/hgrc |
|
55 | $ echo 'changegroup = python "$TESTDIR"/printenv.py changegroup 0' >> .hg/hgrc | |
56 | $ req |
|
56 | $ req | |
57 | pushing to http://localhost:$HGPORT/ |
|
57 | pushing to http://localhost:$HGPORT/ | |
58 | searching for changes |
|
58 | searching for changes | |
59 | remote: adding changesets |
|
59 | remote: adding changesets | |
60 | remote: adding manifests |
|
60 | remote: adding manifests | |
61 | remote: adding file changes |
|
61 | remote: adding file changes | |
62 | remote: added 1 changesets with 1 changes to 1 files |
|
62 | remote: added 1 changesets with 1 changes to 1 files | |
63 | remote: changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_URL=remote:http:*: (glob) |
|
63 | remote: changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_URL=remote:http:*: (glob) | |
64 | % serve errors |
|
64 | % serve errors | |
65 | $ hg rollback |
|
65 | $ hg rollback | |
66 | repository tip rolled back to revision 0 (undo serve) |
|
66 | repository tip rolled back to revision 0 (undo serve) | |
67 | working directory now based on revision 0 |
|
67 | working directory now based on revision 0 | |
68 |
|
68 | |||
69 | expect success, server lacks the unbundlehash capability |
|
69 | expect success, server lacks the unbundlehash capability | |
70 |
|
70 | |||
71 | $ cat > unbundlehash-off.py << EOF |
|
71 | $ CAP=unbundlehash | |
72 | > from mercurial import extensions, repo |
|
72 | $ . "$TESTDIR/notcapable" | |
73 | > def extsetup(): |
|
|||
74 | > extensions.wrapfunction(repo.repository, 'capable', wrapper) |
|
|||
75 | > def wrapper(orig, self, name, *args, **kwargs): |
|
|||
76 | > if name == 'unbundlehash': |
|
|||
77 | > return False |
|
|||
78 | > return orig(self, name, *args, **kwargs) |
|
|||
79 | > EOF |
|
|||
80 | $ echo '[extensions]' >> .hg/hgrc |
|
|||
81 | $ echo "unbundlehash-off = `pwd`/unbundlehash-off.py" >> .hg/hgrc |
|
|||
82 |
$ |
|
73 | $ req | |
83 | pushing to http://localhost:$HGPORT/ |
|
74 | pushing to http://localhost:$HGPORT/ | |
84 | searching for changes |
|
75 | searching for changes | |
85 | remote: adding changesets |
|
76 | remote: adding changesets | |
86 | remote: adding manifests |
|
77 | remote: adding manifests | |
87 | remote: adding file changes |
|
78 | remote: adding file changes | |
88 | remote: added 1 changesets with 1 changes to 1 files |
|
79 | remote: added 1 changesets with 1 changes to 1 files | |
89 | remote: changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_URL=remote:http:*: (glob) |
|
80 | remote: changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_URL=remote:http:*: (glob) | |
90 | % serve errors |
|
81 | % serve errors | |
91 | $ hg rollback |
|
82 | $ hg rollback | |
92 | repository tip rolled back to revision 0 (undo serve) |
|
83 | repository tip rolled back to revision 0 (undo serve) | |
93 | working directory now based on revision 0 |
|
84 | working directory now based on revision 0 | |
94 |
|
85 | |||
95 | expect authorization error: all users denied |
|
86 | expect authorization error: all users denied | |
96 |
|
87 | |||
97 | $ echo '[web]' > .hg/hgrc |
|
88 | $ echo '[web]' > .hg/hgrc | |
98 | $ echo 'push_ssl = false' >> .hg/hgrc |
|
89 | $ echo 'push_ssl = false' >> .hg/hgrc | |
99 | $ echo 'deny_push = *' >> .hg/hgrc |
|
90 | $ echo 'deny_push = *' >> .hg/hgrc | |
100 | $ req |
|
91 | $ req | |
101 | pushing to http://localhost:$HGPORT/ |
|
92 | pushing to http://localhost:$HGPORT/ | |
102 | searching for changes |
|
93 | searching for changes | |
103 | abort: authorization failed |
|
94 | abort: authorization failed | |
104 | % serve errors |
|
95 | % serve errors | |
105 |
|
96 | |||
106 | expect authorization error: some users denied, users must be authenticated |
|
97 | expect authorization error: some users denied, users must be authenticated | |
107 |
|
98 | |||
108 | $ echo 'deny_push = unperson' >> .hg/hgrc |
|
99 | $ echo 'deny_push = unperson' >> .hg/hgrc | |
109 | $ req |
|
100 | $ req | |
110 | pushing to http://localhost:$HGPORT/ |
|
101 | pushing to http://localhost:$HGPORT/ | |
111 | searching for changes |
|
102 | searching for changes | |
112 | abort: authorization failed |
|
103 | abort: authorization failed | |
113 | % serve errors |
|
104 | % serve errors |
General Comments 0
You need to be logged in to leave comments.
Login now