##// END OF EJS Templates
tests: port value-less unbundle capability test to test-push-http.t...
Gregory Szorc -
r36318:fefd57bd stable
parent child Browse files
Show More
@@ -1,202 +1,234 b''
1 1 #require killdaemons
2 2
3 3 $ hg init test
4 4 $ cd test
5 5 $ echo a > a
6 6 $ hg ci -Ama
7 7 adding a
8 8 $ cd ..
9 9 $ hg clone test test2
10 10 updating to branch default
11 11 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
12 12 $ cd test2
13 13 $ echo a >> a
14 14 $ hg ci -mb
15 15 $ req() {
16 16 > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
17 17 > cat hg.pid >> $DAEMON_PIDS
18 18 > hg --cwd ../test2 push http://localhost:$HGPORT/
19 19 > exitstatus=$?
20 20 > killdaemons.py
21 21 > echo % serve errors
22 22 > cat errors.log
23 23 > return $exitstatus
24 24 > }
25 25 $ cd ../test
26 26
27 27 expect ssl error
28 28
29 29 $ req
30 30 pushing to http://localhost:$HGPORT/
31 31 searching for changes
32 32 abort: HTTP Error 403: ssl required
33 33 % serve errors
34 34 [255]
35 35
36 36 expect authorization error
37 37
38 38 $ echo '[web]' > .hg/hgrc
39 39 $ echo 'push_ssl = false' >> .hg/hgrc
40 40 $ req
41 41 pushing to http://localhost:$HGPORT/
42 42 searching for changes
43 43 abort: authorization failed
44 44 % serve errors
45 45 [255]
46 46
47 47 expect authorization error: must have authorized user
48 48
49 49 $ echo 'allow_push = unperson' >> .hg/hgrc
50 50 $ req
51 51 pushing to http://localhost:$HGPORT/
52 52 searching for changes
53 53 abort: authorization failed
54 54 % serve errors
55 55 [255]
56 56
57 57 expect success
58 58
59 59 $ cat > $TESTTMP/hook.sh <<'EOF'
60 60 > echo "phase-move: $HG_NODE: $HG_OLDPHASE -> $HG_PHASE"
61 61 > EOF
62 62
63 63 $ cat >> .hg/hgrc <<EOF
64 64 > allow_push = *
65 65 > [hooks]
66 66 > changegroup = sh -c "printenv.py changegroup 0"
67 67 > pushkey = sh -c "printenv.py pushkey 0"
68 68 > txnclose-phase.test = sh $TESTTMP/hook.sh
69 69 > EOF
70 70 $ req
71 71 pushing to http://localhost:$HGPORT/
72 72 searching for changes
73 73 remote: adding changesets
74 74 remote: adding manifests
75 75 remote: adding file changes
76 76 remote: added 1 changesets with 1 changes to 1 files
77 77 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public
78 78 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public
79 79 remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
80 80 % serve errors
81 81 $ hg rollback
82 82 repository tip rolled back to revision 0 (undo serve)
83 83
84 84 expect success, server lacks the httpheader capability
85 85
86 86 $ CAP=httpheader
87 87 $ . "$TESTDIR/notcapable"
88 88 $ req
89 89 pushing to http://localhost:$HGPORT/
90 90 searching for changes
91 91 remote: adding changesets
92 92 remote: adding manifests
93 93 remote: adding file changes
94 94 remote: added 1 changesets with 1 changes to 1 files
95 95 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public
96 96 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public
97 97 remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
98 98 % serve errors
99 99 $ hg rollback
100 100 repository tip rolled back to revision 0 (undo serve)
101 101
102 102 expect success, server lacks the unbundlehash capability
103 103
104 104 $ CAP=unbundlehash
105 105 $ . "$TESTDIR/notcapable"
106 106 $ req
107 107 pushing to http://localhost:$HGPORT/
108 108 searching for changes
109 109 remote: adding changesets
110 110 remote: adding manifests
111 111 remote: adding file changes
112 112 remote: added 1 changesets with 1 changes to 1 files
113 113 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public
114 114 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public
115 115 remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
116 116 % serve errors
117 117 $ hg rollback
118 118 repository tip rolled back to revision 0 (undo serve)
119 119
120 expect success, pre-d1b16a746db6 server supports the unbundle capability, but
121 has no parameter
122
123 $ cat <<EOF > notcapable-unbundleparam.py
124 > from mercurial import extensions, httppeer
125 > def capable(orig, self, name):
126 > if name == 'unbundle':
127 > return True
128 > return orig(self, name)
129 > def uisetup(ui):
130 > extensions.wrapfunction(httppeer.httppeer, 'capable', capable)
131 > EOF
132 $ cp $HGRCPATH $HGRCPATH.orig
133 $ cat <<EOF >> $HGRCPATH
134 > [extensions]
135 > notcapable-unbundleparam = `pwd`/notcapable-unbundleparam.py
136 > EOF
137 $ req
138 pushing to http://localhost:$HGPORT/
139 searching for changes
140 remote: adding changesets
141 remote: adding manifests
142 remote: adding file changes
143 remote: added 1 changesets with 1 changes to 1 files
144 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public
145 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public
146 remote: changegroup hook: * (glob)
147 % serve errors
148 $ hg rollback
149 repository tip rolled back to revision 0 (undo serve)
150 $ mv $HGRCPATH.orig $HGRCPATH
151
120 152 expect push success, phase change failure
121 153
122 154 $ cat > .hg/hgrc <<EOF
123 155 > [web]
124 156 > push_ssl = false
125 157 > allow_push = *
126 158 > [hooks]
127 159 > prepushkey = sh -c "printenv.py prepushkey 1"
128 160 > [devel]
129 161 > legacy.exchange=phases
130 162 > EOF
131 163 $ req
132 164 pushing to http://localhost:$HGPORT/
133 165 searching for changes
134 166 remote: adding changesets
135 167 remote: adding manifests
136 168 remote: adding file changes
137 169 remote: added 1 changesets with 1 changes to 1 files
138 170 remote: prepushkey hook: HG_BUNDLE2=1 HG_HOOKNAME=prepushkey HG_HOOKTYPE=prepushkey HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NAMESPACE=phases HG_NEW=0 HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_OLD=1 HG_PENDING=$TESTTMP/test HG_PHASES_MOVED=1 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
139 171 remote: pushkey-abort: prepushkey hook exited with status 1
140 172 remote: transaction abort!
141 173 remote: rollback completed
142 174 abort: updating ba677d0156c1 to public failed
143 175 % serve errors
144 176 [255]
145 177
146 178 expect phase change success
147 179
148 180 $ cat >> .hg/hgrc <<EOF
149 181 > prepushkey = sh -c "printenv.py prepushkey 0"
150 182 > [devel]
151 183 > legacy.exchange=
152 184 > EOF
153 185 $ req
154 186 pushing to http://localhost:$HGPORT/
155 187 searching for changes
156 188 remote: adding changesets
157 189 remote: adding manifests
158 190 remote: adding file changes
159 191 remote: added 1 changesets with 1 changes to 1 files
160 192 % serve errors
161 193 $ hg rollback
162 194 repository tip rolled back to revision 0 (undo serve)
163 195
164 196 expect authorization error: all users denied
165 197
166 198 $ echo '[web]' > .hg/hgrc
167 199 $ echo 'push_ssl = false' >> .hg/hgrc
168 200 $ echo 'deny_push = *' >> .hg/hgrc
169 201 $ req
170 202 pushing to http://localhost:$HGPORT/
171 203 searching for changes
172 204 abort: authorization failed
173 205 % serve errors
174 206 [255]
175 207
176 208 expect authorization error: some users denied, users must be authenticated
177 209
178 210 $ echo 'deny_push = unperson' >> .hg/hgrc
179 211 $ req
180 212 pushing to http://localhost:$HGPORT/
181 213 searching for changes
182 214 abort: authorization failed
183 215 % serve errors
184 216 [255]
185 217
186 218 $ cat > .hg/hgrc <<EOF
187 219 > [web]
188 220 > push_ssl = false
189 221 > allow_push = *
190 222 > [experimental]
191 223 > httppostargs=true
192 224 > EOF
193 225 $ req
194 226 pushing to http://localhost:$HGPORT/
195 227 searching for changes
196 228 remote: adding changesets
197 229 remote: adding manifests
198 230 remote: adding file changes
199 231 remote: added 1 changesets with 1 changes to 1 files
200 232 % serve errors
201 233
202 234 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now