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