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