Debian Codegraph @

tests/test-http-bundle1.t

raw
1 #require serve
2
3 This test is a duplicate of 'test-http.t', feel free to factor out
4 parts that are not bundle1/bundle2 specific.
5
6 $ cat << EOF >> $HGRCPATH
7 > [devel]
8 > # This test is dedicated to interaction through old bundle
9 > legacy.exchange = bundle1
10 > EOF
11
12 $ hg init test
13 $ cd test
14 $ echo foo>foo
15 $ mkdir foo.d foo.d/bAr.hg.d foo.d/baR.d.hg
16 $ echo foo>foo.d/foo
17 $ echo bar>foo.d/bAr.hg.d/BaR
18 $ echo bar>foo.d/baR.d.hg/bAR
19 $ hg commit -A -m 1
20 adding foo
21 adding foo.d/bAr.hg.d/BaR
22 adding foo.d/baR.d.hg/bAR
23 adding foo.d/foo
24 $ hg serve -p $HGPORT -d --pid-file=../hg1.pid -E ../error.log
25 $ hg serve --config server.uncompressed=False -p $HGPORT1 -d --pid-file=../hg2.pid
26
27 Test server address cannot be reused
28
29 $ hg serve -p $HGPORT1 2>&1
30 abort: cannot start server at 'localhost:$HGPORT1': $EADDRINUSE$
31 [255]
32
33 $ cd ..
34 $ cat hg1.pid hg2.pid >> $DAEMON_PIDS
35
36 clone via stream
37
38 $ hg clone --stream http://localhost:$HGPORT/ copy 2>&1
39 streaming all changes
40 * files to transfer, * bytes of data (glob)
41 stream-cloned * files / * bytes in * seconds (*/sec) (glob)
42 searching for changes
43 no changes found
44 updating to branch default
45 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
46 $ hg verify -R copy -q
47
48 try to clone via stream, should use pull instead
49
50 $ hg clone --stream http://localhost:$HGPORT1/ copy2
51 warning: stream clone requested but server has them disabled
52 requesting all changes
53 adding changesets
54 adding manifests
55 adding file changes
56 added 1 changesets with 4 changes to 4 files
57 new changesets 8b6053c928fe
58 updating to branch default
59 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
60
61 try to clone via stream but missing requirements, so should use pull instead
62
63 $ cat > $TESTTMP/removesupportedformat.py << EOF
64 > from mercurial import localrepo
65 > def reposetup(ui, repo):
66 > local = repo.local()
67 > if local is not None:
68 > local.supported.remove(b'generaldelta')
69 > EOF
70
71 $ hg clone --config extensions.rsf=$TESTTMP/removesupportedformat.py --stream http://localhost:$HGPORT/ copy3
72 warning: stream clone requested but client is missing requirements: generaldelta
73 (see https://www.mercurial-scm.org/wiki/MissingRequirement for more information)
74 requesting all changes
75 adding changesets
76 adding manifests
77 adding file changes
78 added 1 changesets with 4 changes to 4 files
79 new changesets 8b6053c928fe
80 updating to branch default
81 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
82
83 clone via pull
84
85 $ hg clone http://localhost:$HGPORT1/ copy-pull
86 requesting all changes
87 adding changesets
88 adding manifests
89 adding file changes
90 added 1 changesets with 4 changes to 4 files
91 new changesets 8b6053c928fe
92 updating to branch default
93 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
94 $ hg verify -R copy-pull -q
95 $ cd test
96 $ echo bar > bar
97 $ hg commit -A -d '1 0' -m 2
98 adding bar
99 $ cd ..
100
101 clone over http with --update
102
103 $ hg clone http://localhost:$HGPORT1/ updated --update 0
104 requesting all changes
105 adding changesets
106 adding manifests
107 adding file changes
108 added 2 changesets with 5 changes to 5 files
109 new changesets 8b6053c928fe:5fed3813f7f5
110 updating to branch default
111 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
112 $ hg log -r . -R updated
113 changeset: 0:8b6053c928fe
114 user: test
115 date: Thu Jan 01 00:00:00 1970 +0000
116 summary: 1
117
118 $ rm -rf updated
119
120 incoming via HTTP
121
122 $ hg clone http://localhost:$HGPORT1/ --rev 0 partial
123 adding changesets
124 adding manifests
125 adding file changes
126 added 1 changesets with 4 changes to 4 files
127 new changesets 8b6053c928fe
128 updating to branch default
129 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
130 $ cd partial
131 $ touch LOCAL
132 $ hg ci -qAm LOCAL
133 $ hg incoming http://localhost:$HGPORT1/ --template '{desc}\n'
134 comparing with http://localhost:$HGPORT1/
135 searching for changes
136 2
137 $ cd ..
138
139 pull
140
141 $ cd copy-pull
142 $ cat >> .hg/hgrc <<EOF
143 > [hooks]
144 > changegroup = sh -c "printenv.py --line changegroup"
145 > EOF
146 $ hg pull
147 pulling from http://localhost:$HGPORT1/
148 searching for changes
149 adding changesets
150 adding manifests
151 adding file changes
152 added 1 changesets with 1 changes to 1 files
153 new changesets 5fed3813f7f5
154 changegroup hook: HG_HOOKNAME=changegroup
155 HG_HOOKTYPE=changegroup
156 HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d
157 HG_NODE_LAST=5fed3813f7f5e1824344fdc9cf8f63bb662c292d
158 HG_SOURCE=pull
159 HG_TXNID=TXN:$ID$
160 HG_TXNNAME=pull
161 http://localhost:$HGPORT1/
162 HG_URL=http://localhost:$HGPORT1/
163
164 (run 'hg update' to get a working copy)
165 $ cd ..
166
167 clone from invalid URL
168
169 $ hg clone http://localhost:$HGPORT/bad
170 abort: HTTP Error 404: Not Found
171 [100]
172
173 test http authentication
174 + use the same server to test server side streaming preference
175
176 $ cd test
177
178 $ hg serve --config extensions.x=$TESTDIR/httpserverauth.py -p $HGPORT2 -d \
179 > --pid-file=pid --config server.preferuncompressed=True \
180 > --config web.push_ssl=False --config web.allow_push=* -A ../access.log
181 $ cat pid >> $DAEMON_PIDS
182
183 $ cat << EOF > get_pass.py
184 > from mercurial import util
185 > def newgetpass():
186 > return "pass"
187 > util.get_password = newgetpass
188 > EOF
189
190 $ hg id http://localhost:$HGPORT2/
191 abort: http authorization required for http://localhost:$HGPORT2/
192 [255]
193 $ hg id http://localhost:$HGPORT2/
194 abort: http authorization required for http://localhost:$HGPORT2/
195 [255]
196 $ hg id --config ui.interactive=true --config extensions.getpass=get_pass.py http://user@localhost:$HGPORT2/
197 http authorization required for http://localhost:$HGPORT2/
198 realm: mercurial
199 user: user
200 password: 5fed3813f7f5
201 $ hg id http://user:pass@localhost:$HGPORT2/
202 5fed3813f7f5
203 $ echo '[auth]' >> .hg/hgrc
204 $ echo 'l.schemes=http' >> .hg/hgrc
205 $ echo 'l.prefix=lo' >> .hg/hgrc
206 $ echo 'l.username=user' >> .hg/hgrc
207 $ echo 'l.password=pass' >> .hg/hgrc
208 $ hg id http://localhost:$HGPORT2/
209 5fed3813f7f5
210 $ hg id http://localhost:$HGPORT2/
211 5fed3813f7f5
212 $ hg id http://user@localhost:$HGPORT2/
213 5fed3813f7f5
214
215 $ hg clone http://user:pass@localhost:$HGPORT2/ dest 2>&1
216 streaming all changes
217 * files to transfer, * of data (glob)
218 stream-cloned * files / * in * seconds (*/sec) (glob)
219 searching for changes
220 no changes found
221 updating to branch default
222 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
223
224 --pull should override server's preferuncompressed
225
226 $ hg clone --pull http://user:pass@localhost:$HGPORT2/ dest-pull 2>&1
227 requesting all changes
228 adding changesets
229 adding manifests
230 adding file changes
231 added 2 changesets with 5 changes to 5 files
232 new changesets 8b6053c928fe:5fed3813f7f5
233 updating to branch default
234 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
235
236 $ hg id http://user2@localhost:$HGPORT2/
237 abort: http authorization required for http://localhost:$HGPORT2/
238 [255]
239 $ hg id http://user:pass2@localhost:$HGPORT2/
240 abort: HTTP Error 403: no
241 [100]
242
243 $ hg -R dest-pull tag -r tip top
244 $ hg -R dest-pull push http://user:pass@localhost:$HGPORT2/
245 pushing to http://user:***@localhost:$HGPORT2/
246 searching for changes
247 remote: adding changesets
248 remote: adding manifests
249 remote: adding file changes
250 remote: added 1 changesets with 1 changes to 1 files
251 $ hg rollback -q
252
253 $ sed 's/.*] "/"/' < ../access.log
254 "GET /?cmd=capabilities HTTP/1.1" 401 -
255 "GET /?cmd=capabilities HTTP/1.1" 401 -
256 "GET /?cmd=capabilities HTTP/1.1" 401 -
257 "GET /?cmd=capabilities HTTP/1.1" 200 -
258 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
259 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
260 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
261 "GET /?cmd=capabilities HTTP/1.1" 401 -
262 "GET /?cmd=capabilities HTTP/1.1" 200 -
263 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
264 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
265 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
266 "GET /?cmd=capabilities HTTP/1.1" 401 -
267 "GET /?cmd=capabilities HTTP/1.1" 200 -
268 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
269 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
270 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
271 "GET /?cmd=capabilities HTTP/1.1" 401 -
272 "GET /?cmd=capabilities HTTP/1.1" 200 -
273 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
274 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
275 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
276 "GET /?cmd=capabilities HTTP/1.1" 401 -
277 "GET /?cmd=capabilities HTTP/1.1" 200 -
278 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
279 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
280 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
281 "GET /?cmd=capabilities HTTP/1.1" 401 -
282 "GET /?cmd=capabilities HTTP/1.1" 200 -
283 "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
284 "GET /?cmd=stream_out HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
285 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
286 "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D5fed3813f7f5e1824344fdc9cf8f63bb662c292d x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
287 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
288 "GET /?cmd=capabilities HTTP/1.1" 401 -
289 "GET /?cmd=capabilities HTTP/1.1" 200 -
290 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
291 "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
292 "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
293 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
294 "GET /?cmd=capabilities HTTP/1.1" 401 -
295 "GET /?cmd=capabilities HTTP/1.1" 401 -
296 "GET /?cmd=capabilities HTTP/1.1" 403 -
297 "GET /?cmd=capabilities HTTP/1.1" 401 -
298 "GET /?cmd=capabilities HTTP/1.1" 200 -
299 "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D7f4e523d01f2cc3765ac8934da3d14db775ff872 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
300 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
301 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
302 "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
303 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
304 "POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=686173686564+5eb5abfefeea63c80dd7553bcc3783f37e0c5524* (glob)
305 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
306
307 $ cd ..
308
309 clone of serve with repo in root and unserved subrepo (issue2970)
310
311 $ hg --cwd test init sub
312 $ echo empty > test/sub/empty
313 $ hg --cwd test/sub add empty
314 $ hg --cwd test/sub commit -qm 'add empty'
315 $ hg --cwd test/sub tag -r 0 something
316 $ echo sub = sub > test/.hgsub
317 $ hg --cwd test add .hgsub
318 $ hg --cwd test commit -qm 'add subrepo'
319 $ hg clone http://localhost:$HGPORT noslash-clone
320 requesting all changes
321 adding changesets
322 adding manifests
323 adding file changes
324 added 3 changesets with 7 changes to 7 files
325 new changesets 8b6053c928fe:56f9bc90cce6
326 updating to branch default
327 cloning subrepo sub from http://localhost:$HGPORT/sub
328 abort: HTTP Error 404: Not Found
329 [100]
330 $ hg clone http://localhost:$HGPORT/ slash-clone
331 requesting all changes
332 adding changesets
333 adding manifests
334 adding file changes
335 added 3 changesets with 7 changes to 7 files
336 new changesets 8b6053c928fe:56f9bc90cce6
337 updating to branch default
338 cloning subrepo sub from http://localhost:$HGPORT/sub
339 abort: HTTP Error 404: Not Found
340 [100]
341
342 check error log
343
344 $ cat error.log
345
346 Check error reporting while pulling/cloning
347
348 $ $RUNTESTDIR/killdaemons.py
349 $ hg serve -R test -p $HGPORT -d --pid-file=hg3.pid -E error.log --config extensions.crash=${TESTDIR}/crashgetbundler.py
350 $ cat hg3.pid >> $DAEMON_PIDS
351 $ hg clone http://localhost:$HGPORT/ abort-clone
352 requesting all changes
353 abort: remote error:
354 this is an exercise
355 [100]
356 $ cat error.log
357
358 disable pull-based clones
359
360 $ hg serve -R test -p $HGPORT1 -d --pid-file=hg4.pid -E error.log --config server.disablefullbundle=True
361 $ cat hg4.pid >> $DAEMON_PIDS
362 $ hg clone http://localhost:$HGPORT1/ disable-pull-clone
363 requesting all changes
364 abort: remote error:
365 server has pull-based clones disabled
366 [100]
367
368 ... but keep stream clones working
369
370 $ hg clone --stream --noupdate http://localhost:$HGPORT1/ test-stream-clone
371 streaming all changes
372 * files to transfer, * of data (glob)
373 stream-cloned * files / * KB in * seconds (* */sec) (glob)
374 searching for changes
375 no changes found
376
377 ... and also keep partial clones and pulls working
378 $ hg clone http://localhost:$HGPORT1 --rev 0 test-partial-clone
379 adding changesets
380 adding manifests
381 adding file changes
382 added 1 changesets with 4 changes to 4 files
383 new changesets 8b6053c928fe
384 updating to branch default
385 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
386 $ hg pull -R test-partial-clone
387 pulling from http://localhost:$HGPORT1/
388 searching for changes
389 adding changesets
390 adding manifests
391 adding file changes
392 added 2 changesets with 3 changes to 3 files
393 new changesets 5fed3813f7f5:56f9bc90cce6
394 (run 'hg update' to get a working copy)
395
396 $ cat error.log