##// END OF EJS Templates
tests: simplify calls to dummyssh...
Matt Mackall -
r25476:46727fea default
parent child Browse files
Show More
@@ -1,807 +1,807 b''
1 1 #require serve
2 2
3 3 $ cat << EOF >> $HGRCPATH
4 4 > [ui]
5 5 > logtemplate={rev}:{node|short} {desc|firstline}
6 6 > [phases]
7 7 > publish=False
8 8 > [experimental]
9 9 > evolution=createmarkers,exchange
10 10 > # drop me once bundle2 is the default,
11 11 > # added to get test change early.
12 12 > bundle2-exp = True
13 13 > EOF
14 14
15 15 initialize
16 16
17 17 $ hg init a
18 18 $ cd a
19 19 $ echo 'test' > test
20 20 $ hg commit -Am'test'
21 21 adding test
22 22
23 23 set bookmarks
24 24
25 25 $ hg bookmark X
26 26 $ hg bookmark Y
27 27 $ hg bookmark Z
28 28
29 29 import bookmark by name
30 30
31 31 $ hg init ../b
32 32 $ cd ../b
33 33 $ hg book Y
34 34 $ hg book
35 35 * Y -1:000000000000
36 36 $ hg pull ../a
37 37 pulling from ../a
38 38 requesting all changes
39 39 adding changesets
40 40 adding manifests
41 41 adding file changes
42 42 added 1 changesets with 1 changes to 1 files
43 43 adding remote bookmark X
44 44 updating bookmark Y
45 45 adding remote bookmark Z
46 46 (run 'hg update' to get a working copy)
47 47 $ hg bookmarks
48 48 X 0:4e3505fd9583
49 49 * Y 0:4e3505fd9583
50 50 Z 0:4e3505fd9583
51 51 $ hg debugpushkey ../a namespaces
52 52 bookmarks
53 53 namespaces
54 54 obsolete
55 55 phases
56 56 $ hg debugpushkey ../a bookmarks
57 57 X 4e3505fd95835d721066b76e75dbb8cc554d7f77
58 58 Y 4e3505fd95835d721066b76e75dbb8cc554d7f77
59 59 Z 4e3505fd95835d721066b76e75dbb8cc554d7f77
60 60
61 61 delete the bookmark to re-pull it
62 62
63 63 $ hg book -d X
64 64 $ hg pull -B X ../a
65 65 pulling from ../a
66 66 no changes found
67 67 adding remote bookmark X
68 68
69 69 finally no-op pull
70 70
71 71 $ hg pull -B X ../a
72 72 pulling from ../a
73 73 no changes found
74 74 $ hg bookmark
75 75 X 0:4e3505fd9583
76 76 * Y 0:4e3505fd9583
77 77 Z 0:4e3505fd9583
78 78
79 79 export bookmark by name
80 80
81 81 $ hg bookmark W
82 82 $ hg bookmark foo
83 83 $ hg bookmark foobar
84 84 $ hg push -B W ../a
85 85 pushing to ../a
86 86 searching for changes
87 87 no changes found
88 88 exporting bookmark W
89 89 [1]
90 90 $ hg -R ../a bookmarks
91 91 W -1:000000000000
92 92 X 0:4e3505fd9583
93 93 Y 0:4e3505fd9583
94 94 * Z 0:4e3505fd9583
95 95
96 96 delete a remote bookmark
97 97
98 98 $ hg book -d W
99 99 $ hg push -B W ../a
100 100 pushing to ../a
101 101 searching for changes
102 102 no changes found
103 103 deleting remote bookmark W
104 104 [1]
105 105
106 106 push/pull name that doesn't exist
107 107
108 108 $ hg push -B badname ../a
109 109 pushing to ../a
110 110 searching for changes
111 111 bookmark badname does not exist on the local or remote repository!
112 112 no changes found
113 113 [2]
114 114 $ hg pull -B anotherbadname ../a
115 115 pulling from ../a
116 116 abort: remote bookmark anotherbadname not found!
117 117 [255]
118 118
119 119 divergent bookmarks
120 120
121 121 $ cd ../a
122 122 $ echo c1 > f1
123 123 $ hg ci -Am1
124 124 adding f1
125 125 $ hg book -f @
126 126 $ hg book -f X
127 127 $ hg book
128 128 @ 1:0d2164f0ce0d
129 129 * X 1:0d2164f0ce0d
130 130 Y 0:4e3505fd9583
131 131 Z 1:0d2164f0ce0d
132 132
133 133 $ cd ../b
134 134 $ hg up
135 135 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
136 136 updating bookmark foobar
137 137 $ echo c2 > f2
138 138 $ hg ci -Am2
139 139 adding f2
140 140 $ hg book -if @
141 141 $ hg book -if X
142 142 $ hg book
143 143 @ 1:9b140be10808
144 144 X 1:9b140be10808
145 145 Y 0:4e3505fd9583
146 146 Z 0:4e3505fd9583
147 147 foo -1:000000000000
148 148 * foobar 1:9b140be10808
149 149
150 150 $ hg pull --config paths.foo=../a foo
151 151 pulling from $TESTTMP/a (glob)
152 152 searching for changes
153 153 adding changesets
154 154 adding manifests
155 155 adding file changes
156 156 added 1 changesets with 1 changes to 1 files (+1 heads)
157 157 divergent bookmark @ stored as @foo
158 158 divergent bookmark X stored as X@foo
159 159 updating bookmark Z
160 160 (run 'hg heads' to see heads, 'hg merge' to merge)
161 161 $ hg book
162 162 @ 1:9b140be10808
163 163 @foo 2:0d2164f0ce0d
164 164 X 1:9b140be10808
165 165 X@foo 2:0d2164f0ce0d
166 166 Y 0:4e3505fd9583
167 167 Z 2:0d2164f0ce0d
168 168 foo -1:000000000000
169 169 * foobar 1:9b140be10808
170 170
171 171 (test that too many divergence of bookmark)
172 172
173 173 $ python $TESTDIR/seq.py 1 100 | while read i; do hg bookmarks -r 000000000000 "X@${i}"; done
174 174 $ hg pull ../a
175 175 pulling from ../a
176 176 searching for changes
177 177 no changes found
178 178 warning: failed to assign numbered name to divergent bookmark X
179 179 divergent bookmark @ stored as @1
180 180 $ hg bookmarks | grep '^ X' | grep -v ':000000000000'
181 181 X 1:9b140be10808
182 182 X@foo 2:0d2164f0ce0d
183 183
184 184 (test that remotely diverged bookmarks are reused if they aren't changed)
185 185
186 186 $ hg bookmarks | grep '^ @'
187 187 @ 1:9b140be10808
188 188 @1 2:0d2164f0ce0d
189 189 @foo 2:0d2164f0ce0d
190 190 $ hg pull ../a
191 191 pulling from ../a
192 192 searching for changes
193 193 no changes found
194 194 warning: failed to assign numbered name to divergent bookmark X
195 195 divergent bookmark @ stored as @1
196 196 $ hg bookmarks | grep '^ @'
197 197 @ 1:9b140be10808
198 198 @1 2:0d2164f0ce0d
199 199 @foo 2:0d2164f0ce0d
200 200
201 201 $ python $TESTDIR/seq.py 1 100 | while read i; do hg bookmarks -d "X@${i}"; done
202 202 $ hg bookmarks -d "@1"
203 203
204 204 $ hg push -f ../a
205 205 pushing to ../a
206 206 searching for changes
207 207 adding changesets
208 208 adding manifests
209 209 adding file changes
210 210 added 1 changesets with 1 changes to 1 files (+1 heads)
211 211 $ hg -R ../a book
212 212 @ 1:0d2164f0ce0d
213 213 * X 1:0d2164f0ce0d
214 214 Y 0:4e3505fd9583
215 215 Z 1:0d2164f0ce0d
216 216
217 217 explicit pull should overwrite the local version (issue4439)
218 218
219 219 $ hg pull --config paths.foo=../a foo -B X
220 220 pulling from $TESTTMP/a (glob)
221 221 no changes found
222 222 divergent bookmark @ stored as @foo
223 223 importing bookmark X
224 224
225 225 reinstall state for further testing:
226 226
227 227 $ hg book -fr 9b140be10808 X
228 228
229 229 revsets should not ignore divergent bookmarks
230 230
231 231 $ hg bookmark -fr 1 Z
232 232 $ hg log -r 'bookmark()' --template '{rev}:{node|short} {bookmarks}\n'
233 233 0:4e3505fd9583 Y
234 234 1:9b140be10808 @ X Z foobar
235 235 2:0d2164f0ce0d @foo X@foo
236 236 $ hg log -r 'bookmark("X@foo")' --template '{rev}:{node|short} {bookmarks}\n'
237 237 2:0d2164f0ce0d @foo X@foo
238 238 $ hg log -r 'bookmark("re:X@foo")' --template '{rev}:{node|short} {bookmarks}\n'
239 239 2:0d2164f0ce0d @foo X@foo
240 240
241 241 update a remote bookmark from a non-head to a head
242 242
243 243 $ hg up -q Y
244 244 $ echo c3 > f2
245 245 $ hg ci -Am3
246 246 adding f2
247 247 created new head
248 248 $ hg push ../a
249 249 pushing to ../a
250 250 searching for changes
251 251 adding changesets
252 252 adding manifests
253 253 adding file changes
254 254 added 1 changesets with 1 changes to 1 files (+1 heads)
255 255 updating bookmark Y
256 256 $ hg -R ../a book
257 257 @ 1:0d2164f0ce0d
258 258 * X 1:0d2164f0ce0d
259 259 Y 3:f6fc62dde3c0
260 260 Z 1:0d2164f0ce0d
261 261
262 262 update a bookmark in the middle of a client pulling changes
263 263
264 264 $ cd ..
265 265 $ hg clone -q a pull-race
266 266
267 267 We want to use http because it is stateless and therefore more susceptible to
268 268 race conditions
269 269
270 270 $ hg -R pull-race serve -p $HGPORT -d --pid-file=pull-race.pid -E main-error.log
271 271 $ cat pull-race.pid >> $DAEMON_PIDS
272 272
273 273 $ hg clone -q http://localhost:$HGPORT/ pull-race2
274 274 $ cd pull-race
275 275 $ hg up -q Y
276 276 $ echo c4 > f2
277 277 $ hg ci -Am4
278 278 $ echo c5 > f3
279 279 $ cat <<EOF > .hg/hgrc
280 280 > [hooks]
281 281 > outgoing.makecommit = hg ci -Am5; echo committed in pull-race
282 282 > EOF
283 283
284 284 (new config needs a server restart)
285 285
286 286 $ cd ..
287 287 $ killdaemons.py
288 288 $ hg -R pull-race serve -p $HGPORT -d --pid-file=pull-race.pid -E main-error.log
289 289 $ cat pull-race.pid >> $DAEMON_PIDS
290 290 $ cd pull-race2
291 291 $ hg -R $TESTTMP/pull-race book
292 292 @ 1:0d2164f0ce0d
293 293 X 1:0d2164f0ce0d
294 294 * Y 4:b0a5eff05604
295 295 Z 1:0d2164f0ce0d
296 296 $ hg pull
297 297 pulling from http://localhost:$HGPORT/
298 298 searching for changes
299 299 adding changesets
300 300 adding manifests
301 301 adding file changes
302 302 added 1 changesets with 1 changes to 1 files
303 303 updating bookmark Y
304 304 (run 'hg update' to get a working copy)
305 305 $ hg book
306 306 * @ 1:0d2164f0ce0d
307 307 X 1:0d2164f0ce0d
308 308 Y 4:b0a5eff05604
309 309 Z 1:0d2164f0ce0d
310 310
311 311 Update a bookmark right after the initial lookup -B (issue4689)
312 312
313 313 $ echo c6 > ../pull-race/f3 # to be committed during the race
314 314 $ cat <<EOF > ../pull-race/.hg/hgrc
315 315 > [hooks]
316 316 > # If anything to commit, commit it right after the first key listing used
317 317 > # during lookup. This makes the commit appear before the actual getbundle
318 318 > # call.
319 319 > listkeys.makecommit= ((hg st | grep -q M) && (hg commit -m race; echo commited in pull-race)) || exit 0
320 320 > EOF
321 321
322 322 (new config need server restart)
323 323
324 324 $ killdaemons.py
325 325 $ hg -R ../pull-race serve -p $HGPORT -d --pid-file=../pull-race.pid -E main-error.log
326 326 $ cat ../pull-race.pid >> $DAEMON_PIDS
327 327
328 328 $ hg -R $TESTTMP/pull-race book
329 329 @ 1:0d2164f0ce0d
330 330 X 1:0d2164f0ce0d
331 331 * Y 5:35d1ef0a8d1b
332 332 Z 1:0d2164f0ce0d
333 333 $ hg pull -B Y
334 334 pulling from http://localhost:$HGPORT/
335 335 searching for changes
336 336 adding changesets
337 337 adding manifests
338 338 adding file changes
339 339 added 1 changesets with 1 changes to 1 files
340 340 updating bookmark Y
341 341 (run 'hg update' to get a working copy)
342 342 $ hg book
343 343 * @ 1:0d2164f0ce0d
344 344 X 1:0d2164f0ce0d
345 345 Y 5:35d1ef0a8d1b
346 346 Z 1:0d2164f0ce0d
347 347
348 348 (done with this section of the test)
349 349
350 350 $ killdaemons.py
351 351 $ cd ../b
352 352
353 353 diverging a remote bookmark fails
354 354
355 355 $ hg up -q 4e3505fd9583
356 356 $ echo c4 > f2
357 357 $ hg ci -Am4
358 358 adding f2
359 359 created new head
360 360 $ echo c5 > f2
361 361 $ hg ci -Am5
362 362 $ hg log -G
363 363 @ 5:c922c0139ca0 5
364 364 |
365 365 o 4:4efff6d98829 4
366 366 |
367 367 | o 3:f6fc62dde3c0 3
368 368 |/
369 369 | o 2:0d2164f0ce0d 1
370 370 |/
371 371 | o 1:9b140be10808 2
372 372 |/
373 373 o 0:4e3505fd9583 test
374 374
375 375
376 376 $ hg book -f Y
377 377
378 378 $ cat <<EOF > ../a/.hg/hgrc
379 379 > [web]
380 380 > push_ssl = false
381 381 > allow_push = *
382 382 > EOF
383 383
384 384 $ hg -R ../a serve -p $HGPORT2 -d --pid-file=../hg2.pid
385 385 $ cat ../hg2.pid >> $DAEMON_PIDS
386 386
387 387 $ hg push http://localhost:$HGPORT2/
388 388 pushing to http://localhost:$HGPORT2/
389 389 searching for changes
390 390 abort: push creates new remote head c922c0139ca0 with bookmark 'Y'!
391 391 (merge or see "hg help push" for details about pushing new heads)
392 392 [255]
393 393 $ hg -R ../a book
394 394 @ 1:0d2164f0ce0d
395 395 * X 1:0d2164f0ce0d
396 396 Y 3:f6fc62dde3c0
397 397 Z 1:0d2164f0ce0d
398 398
399 399
400 400 Unrelated marker does not alter the decision
401 401
402 402 $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
403 403 $ hg push http://localhost:$HGPORT2/
404 404 pushing to http://localhost:$HGPORT2/
405 405 searching for changes
406 406 abort: push creates new remote head c922c0139ca0 with bookmark 'Y'!
407 407 (merge or see "hg help push" for details about pushing new heads)
408 408 [255]
409 409 $ hg -R ../a book
410 410 @ 1:0d2164f0ce0d
411 411 * X 1:0d2164f0ce0d
412 412 Y 3:f6fc62dde3c0
413 413 Z 1:0d2164f0ce0d
414 414
415 415 Update to a successor works
416 416
417 417 $ hg id --debug -r 3
418 418 f6fc62dde3c0771e29704af56ba4d8af77abcc2f
419 419 $ hg id --debug -r 4
420 420 4efff6d98829d9c824c621afd6e3f01865f5439f
421 421 $ hg id --debug -r 5
422 422 c922c0139ca03858f655e4a2af4dd02796a63969 tip Y
423 423 $ hg debugobsolete f6fc62dde3c0771e29704af56ba4d8af77abcc2f cccccccccccccccccccccccccccccccccccccccc
424 424 $ hg debugobsolete cccccccccccccccccccccccccccccccccccccccc 4efff6d98829d9c824c621afd6e3f01865f5439f
425 425 $ hg push http://localhost:$HGPORT2/
426 426 pushing to http://localhost:$HGPORT2/
427 427 searching for changes
428 428 remote: adding changesets
429 429 remote: adding manifests
430 430 remote: adding file changes
431 431 remote: added 2 changesets with 2 changes to 1 files (+1 heads)
432 432 remote: 2 new obsolescence markers
433 433 updating bookmark Y
434 434 $ hg -R ../a book
435 435 @ 1:0d2164f0ce0d
436 436 * X 1:0d2164f0ce0d
437 437 Y 5:c922c0139ca0
438 438 Z 1:0d2164f0ce0d
439 439
440 440 hgweb
441 441
442 442 $ cat <<EOF > .hg/hgrc
443 443 > [web]
444 444 > push_ssl = false
445 445 > allow_push = *
446 446 > EOF
447 447
448 448 $ hg serve -p $HGPORT -d --pid-file=../hg.pid -E errors.log
449 449 $ cat ../hg.pid >> $DAEMON_PIDS
450 450 $ cd ../a
451 451
452 452 $ hg debugpushkey http://localhost:$HGPORT/ namespaces
453 453 bookmarks
454 454 namespaces
455 455 obsolete
456 456 phases
457 457 $ hg debugpushkey http://localhost:$HGPORT/ bookmarks
458 458 @ 9b140be1080824d768c5a4691a564088eede71f9
459 459 X 9b140be1080824d768c5a4691a564088eede71f9
460 460 Y c922c0139ca03858f655e4a2af4dd02796a63969
461 461 Z 9b140be1080824d768c5a4691a564088eede71f9
462 462 foo 0000000000000000000000000000000000000000
463 463 foobar 9b140be1080824d768c5a4691a564088eede71f9
464 464 $ hg out -B http://localhost:$HGPORT/
465 465 comparing with http://localhost:$HGPORT/
466 466 searching for changed bookmarks
467 467 @ 0d2164f0ce0d
468 468 X 0d2164f0ce0d
469 469 Z 0d2164f0ce0d
470 470 foo
471 471 foobar
472 472 $ hg push -B Z http://localhost:$HGPORT/
473 473 pushing to http://localhost:$HGPORT/
474 474 searching for changes
475 475 no changes found
476 476 updating bookmark Z
477 477 [1]
478 478 $ hg book -d Z
479 479 $ hg in -B http://localhost:$HGPORT/
480 480 comparing with http://localhost:$HGPORT/
481 481 searching for changed bookmarks
482 482 @ 9b140be10808
483 483 X 9b140be10808
484 484 Z 0d2164f0ce0d
485 485 foo 000000000000
486 486 foobar 9b140be10808
487 487 $ hg pull -B Z http://localhost:$HGPORT/
488 488 pulling from http://localhost:$HGPORT/
489 489 no changes found
490 490 divergent bookmark @ stored as @1
491 491 divergent bookmark X stored as X@1
492 492 adding remote bookmark Z
493 493 adding remote bookmark foo
494 494 adding remote bookmark foobar
495 495 $ hg clone http://localhost:$HGPORT/ cloned-bookmarks
496 496 requesting all changes
497 497 adding changesets
498 498 adding manifests
499 499 adding file changes
500 500 added 5 changesets with 5 changes to 3 files (+2 heads)
501 501 2 new obsolescence markers
502 502 updating to bookmark @
503 503 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
504 504 $ hg -R cloned-bookmarks bookmarks
505 505 * @ 1:9b140be10808
506 506 X 1:9b140be10808
507 507 Y 4:c922c0139ca0
508 508 Z 2:0d2164f0ce0d
509 509 foo -1:000000000000
510 510 foobar 1:9b140be10808
511 511
512 512 $ cd ..
513 513
514 514 Test to show result of bookmarks comparision
515 515
516 516 $ mkdir bmcomparison
517 517 $ cd bmcomparison
518 518
519 519 $ hg init source
520 520 $ hg -R source debugbuilddag '+2*2*3*4'
521 521 $ hg -R source log -G --template '{rev}:{node|short}'
522 522 o 4:e7bd5218ca15
523 523 |
524 524 | o 3:6100d3090acf
525 525 |/
526 526 | o 2:fa942426a6fd
527 527 |/
528 528 | o 1:66f7d451a68b
529 529 |/
530 530 o 0:1ea73414a91b
531 531
532 532 $ hg -R source bookmarks -r 0 SAME
533 533 $ hg -R source bookmarks -r 0 ADV_ON_REPO1
534 534 $ hg -R source bookmarks -r 0 ADV_ON_REPO2
535 535 $ hg -R source bookmarks -r 0 DIFF_ADV_ON_REPO1
536 536 $ hg -R source bookmarks -r 0 DIFF_ADV_ON_REPO2
537 537 $ hg -R source bookmarks -r 1 DIVERGED
538 538
539 539 $ hg clone -U source repo1
540 540
541 541 (test that incoming/outgoing exit with 1, if there is no bookmark to
542 542 be excahnged)
543 543
544 544 $ hg -R repo1 incoming -B
545 545 comparing with $TESTTMP/bmcomparison/source
546 546 searching for changed bookmarks
547 547 no changed bookmarks found
548 548 [1]
549 549 $ hg -R repo1 outgoing -B
550 550 comparing with $TESTTMP/bmcomparison/source
551 551 searching for changed bookmarks
552 552 no changed bookmarks found
553 553 [1]
554 554
555 555 $ hg -R repo1 bookmarks -f -r 1 ADD_ON_REPO1
556 556 $ hg -R repo1 bookmarks -f -r 2 ADV_ON_REPO1
557 557 $ hg -R repo1 bookmarks -f -r 3 DIFF_ADV_ON_REPO1
558 558 $ hg -R repo1 bookmarks -f -r 3 DIFF_DIVERGED
559 559 $ hg -R repo1 -q --config extensions.mq= strip 4
560 560 $ hg -R repo1 log -G --template '{node|short} ({bookmarks})'
561 561 o 6100d3090acf (DIFF_ADV_ON_REPO1 DIFF_DIVERGED)
562 562 |
563 563 | o fa942426a6fd (ADV_ON_REPO1)
564 564 |/
565 565 | o 66f7d451a68b (ADD_ON_REPO1 DIVERGED)
566 566 |/
567 567 o 1ea73414a91b (ADV_ON_REPO2 DIFF_ADV_ON_REPO2 SAME)
568 568
569 569
570 570 $ hg clone -U source repo2
571 571 $ hg -R repo2 bookmarks -f -r 1 ADD_ON_REPO2
572 572 $ hg -R repo2 bookmarks -f -r 1 ADV_ON_REPO2
573 573 $ hg -R repo2 bookmarks -f -r 2 DIVERGED
574 574 $ hg -R repo2 bookmarks -f -r 4 DIFF_ADV_ON_REPO2
575 575 $ hg -R repo2 bookmarks -f -r 4 DIFF_DIVERGED
576 576 $ hg -R repo2 -q --config extensions.mq= strip 3
577 577 $ hg -R repo2 log -G --template '{node|short} ({bookmarks})'
578 578 o e7bd5218ca15 (DIFF_ADV_ON_REPO2 DIFF_DIVERGED)
579 579 |
580 580 | o fa942426a6fd (DIVERGED)
581 581 |/
582 582 | o 66f7d451a68b (ADD_ON_REPO2 ADV_ON_REPO2)
583 583 |/
584 584 o 1ea73414a91b (ADV_ON_REPO1 DIFF_ADV_ON_REPO1 SAME)
585 585
586 586
587 587 (test that difference of bookmarks between repositories are fully shown)
588 588
589 589 $ hg -R repo1 incoming -B repo2 -v
590 590 comparing with repo2
591 591 searching for changed bookmarks
592 592 ADD_ON_REPO2 66f7d451a68b added
593 593 ADV_ON_REPO2 66f7d451a68b advanced
594 594 DIFF_ADV_ON_REPO2 e7bd5218ca15 changed
595 595 DIFF_DIVERGED e7bd5218ca15 changed
596 596 DIVERGED fa942426a6fd diverged
597 597 $ hg -R repo1 outgoing -B repo2 -v
598 598 comparing with repo2
599 599 searching for changed bookmarks
600 600 ADD_ON_REPO1 66f7d451a68b added
601 601 ADD_ON_REPO2 deleted
602 602 ADV_ON_REPO1 fa942426a6fd advanced
603 603 DIFF_ADV_ON_REPO1 6100d3090acf advanced
604 604 DIFF_ADV_ON_REPO2 1ea73414a91b changed
605 605 DIFF_DIVERGED 6100d3090acf changed
606 606 DIVERGED 66f7d451a68b diverged
607 607
608 608 $ hg -R repo2 incoming -B repo1 -v
609 609 comparing with repo1
610 610 searching for changed bookmarks
611 611 ADD_ON_REPO1 66f7d451a68b added
612 612 ADV_ON_REPO1 fa942426a6fd advanced
613 613 DIFF_ADV_ON_REPO1 6100d3090acf changed
614 614 DIFF_DIVERGED 6100d3090acf changed
615 615 DIVERGED 66f7d451a68b diverged
616 616 $ hg -R repo2 outgoing -B repo1 -v
617 617 comparing with repo1
618 618 searching for changed bookmarks
619 619 ADD_ON_REPO1 deleted
620 620 ADD_ON_REPO2 66f7d451a68b added
621 621 ADV_ON_REPO2 66f7d451a68b advanced
622 622 DIFF_ADV_ON_REPO1 1ea73414a91b changed
623 623 DIFF_ADV_ON_REPO2 e7bd5218ca15 advanced
624 624 DIFF_DIVERGED e7bd5218ca15 changed
625 625 DIVERGED fa942426a6fd diverged
626 626
627 627 $ cd ..
628 628
629 629 Pushing a bookmark should only push the changes required by that
630 630 bookmark, not all outgoing changes:
631 631 $ hg clone http://localhost:$HGPORT/ addmarks
632 632 requesting all changes
633 633 adding changesets
634 634 adding manifests
635 635 adding file changes
636 636 added 5 changesets with 5 changes to 3 files (+2 heads)
637 637 2 new obsolescence markers
638 638 updating to bookmark @
639 639 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
640 640 $ cd addmarks
641 641 $ echo foo > foo
642 642 $ hg add foo
643 643 $ hg commit -m 'add foo'
644 644 $ echo bar > bar
645 645 $ hg add bar
646 646 $ hg commit -m 'add bar'
647 647 $ hg co "tip^"
648 648 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
649 649 (leaving bookmark @)
650 650 $ hg book add-foo
651 651 $ hg book -r tip add-bar
652 652 Note: this push *must* push only a single changeset, as that's the point
653 653 of this test.
654 654 $ hg push -B add-foo --traceback
655 655 pushing to http://localhost:$HGPORT/
656 656 searching for changes
657 657 remote: adding changesets
658 658 remote: adding manifests
659 659 remote: adding file changes
660 660 remote: added 1 changesets with 1 changes to 1 files
661 661 exporting bookmark add-foo
662 662
663 663 pushing a new bookmark on a new head does not require -f if -B is specified
664 664
665 665 $ hg up -q X
666 666 $ hg book W
667 667 $ echo c5 > f2
668 668 $ hg ci -Am5
669 669 created new head
670 670 $ hg push -B W
671 671 pushing to http://localhost:$HGPORT/
672 672 searching for changes
673 673 remote: adding changesets
674 674 remote: adding manifests
675 675 remote: adding file changes
676 676 remote: added 1 changesets with 1 changes to 1 files (+1 heads)
677 677 exporting bookmark W
678 678 $ hg -R ../b id -r W
679 679 cc978a373a53 tip W
680 680
681 681 Check summary output for incoming/outgoing bookmarks
682 682
683 683 $ hg bookmarks -d X
684 684 $ hg bookmarks -d Y
685 685 $ hg summary --remote | grep '^remote:'
686 686 remote: *, 2 incoming bookmarks, 1 outgoing bookmarks (glob)
687 687
688 688 $ cd ..
689 689
690 690 pushing an unchanged bookmark should result in no changes
691 691
692 692 $ hg init unchanged-a
693 693 $ hg init unchanged-b
694 694 $ cd unchanged-a
695 695 $ echo initial > foo
696 696 $ hg commit -A -m initial
697 697 adding foo
698 698 $ hg bookmark @
699 699 $ hg push -B @ ../unchanged-b
700 700 pushing to ../unchanged-b
701 701 searching for changes
702 702 adding changesets
703 703 adding manifests
704 704 adding file changes
705 705 added 1 changesets with 1 changes to 1 files
706 706 exporting bookmark @
707 707
708 708 $ hg push -B @ ../unchanged-b
709 709 pushing to ../unchanged-b
710 710 searching for changes
711 711 no changes found
712 712 [1]
713 713
714 714
715 715 Check hook preventing push (issue4455)
716 716 ======================================
717 717
718 718 $ hg bookmarks
719 719 * @ 0:55482a6fb4b1
720 720 $ hg log -G
721 721 @ 0:55482a6fb4b1 initial
722 722
723 723 $ hg init ../issue4455-dest
724 724 $ hg push ../issue4455-dest # changesets only
725 725 pushing to ../issue4455-dest
726 726 searching for changes
727 727 adding changesets
728 728 adding manifests
729 729 adding file changes
730 730 added 1 changesets with 1 changes to 1 files
731 731 $ cat >> .hg/hgrc << EOF
732 732 > [paths]
733 733 > local=../issue4455-dest/
734 734 > ssh=ssh://user@dummy/issue4455-dest
735 735 > http=http://localhost:$HGPORT/
736 736 > [ui]
737 > ssh=python "$TESTDIR/dummyssh"
737 > ssh=dummyssh
738 738 > EOF
739 739 $ cat >> ../issue4455-dest/.hg/hgrc << EOF
740 740 > [hooks]
741 741 > prepushkey=false
742 742 > [web]
743 743 > push_ssl = false
744 744 > allow_push = *
745 745 > EOF
746 746 $ killdaemons.py
747 747 $ hg -R ../issue4455-dest serve -p $HGPORT -d --pid-file=../issue4455.pid -E ../issue4455-error.log
748 748 $ cat ../issue4455.pid >> $DAEMON_PIDS
749 749
750 750 Local push
751 751 ----------
752 752
753 753 $ hg push -B @ local
754 754 pushing to $TESTTMP/issue4455-dest (glob)
755 755 searching for changes
756 756 no changes found
757 757 pushkey-abort: prepushkey hook exited with status 1
758 758 exporting bookmark @ failed!
759 759 [1]
760 760 $ hg -R ../issue4455-dest/ bookmarks
761 761 no bookmarks set
762 762
763 763 Using ssh
764 764 ---------
765 765
766 766 $ hg push -B @ ssh --config experimental.bundle2-exp=True
767 767 pushing to ssh://user@dummy/issue4455-dest
768 768 searching for changes
769 769 no changes found
770 770 remote: pushkey-abort: prepushkey hook exited with status 1
771 771 exporting bookmark @ failed!
772 772 [1]
773 773 $ hg -R ../issue4455-dest/ bookmarks
774 774 no bookmarks set
775 775
776 776 $ hg push -B @ ssh --config experimental.bundle2-exp=False
777 777 pushing to ssh://user@dummy/issue4455-dest
778 778 searching for changes
779 779 no changes found
780 780 remote: pushkey-abort: prepushkey hook exited with status 1
781 781 exporting bookmark @ failed!
782 782 [1]
783 783 $ hg -R ../issue4455-dest/ bookmarks
784 784 no bookmarks set
785 785
786 786 Using http
787 787 ----------
788 788
789 789 $ hg push -B @ http --config experimental.bundle2-exp=True
790 790 pushing to http://localhost:$HGPORT/
791 791 searching for changes
792 792 no changes found
793 793 remote: pushkey-abort: prepushkey hook exited with status 1
794 794 exporting bookmark @ failed!
795 795 [1]
796 796 $ hg -R ../issue4455-dest/ bookmarks
797 797 no bookmarks set
798 798
799 799 $ hg push -B @ http --config experimental.bundle2-exp=False
800 800 pushing to http://localhost:$HGPORT/
801 801 searching for changes
802 802 no changes found
803 803 remote: pushkey-abort: prepushkey hook exited with status 1
804 804 exporting bookmark @ failed!
805 805 [1]
806 806 $ hg -R ../issue4455-dest/ bookmarks
807 807 no bookmarks set
@@ -1,719 +1,719 b''
1 1 Test exchange of common information using bundle2
2 2
3 3
4 4 $ getmainid() {
5 5 > hg -R main log --template '{node}\n' --rev "$1"
6 6 > }
7 7
8 8 enable obsolescence
9 9
10 10 $ cat > $TESTTMP/bundle2-pushkey-hook.sh << EOF
11 11 > echo pushkey: lock state after \"\$HG_NAMESPACE\"
12 12 > hg debuglock
13 13 > EOF
14 14
15 15 $ cat >> $HGRCPATH << EOF
16 16 > [experimental]
17 17 > evolution=createmarkers,exchange
18 18 > bundle2-exp=True
19 19 > bundle2-output-capture=True
20 20 > [ui]
21 > ssh=python "$TESTDIR/dummyssh"
21 > ssh=dummyssh
22 22 > logtemplate={rev}:{node|short} {phase} {author} {bookmarks} {desc|firstline}
23 23 > [web]
24 24 > push_ssl = false
25 25 > allow_push = *
26 26 > [phases]
27 27 > publish=False
28 28 > [hooks]
29 29 > pretxnclose.tip = hg log -r tip -T "pre-close-tip:{node|short} {phase} {bookmarks}\n"
30 30 > txnclose.tip = hg log -r tip -T "postclose-tip:{node|short} {phase} {bookmarks}\n"
31 31 > txnclose.env = sh -c "HG_LOCAL= python \"$TESTDIR/printenv.py\" txnclose"
32 32 > pushkey= sh "$TESTTMP/bundle2-pushkey-hook.sh"
33 33 > EOF
34 34
35 35 The extension requires a repo (currently unused)
36 36
37 37 $ hg init main
38 38 $ cd main
39 39 $ touch a
40 40 $ hg add a
41 41 $ hg commit -m 'a'
42 42 pre-close-tip:3903775176ed draft
43 43 postclose-tip:3903775176ed draft
44 44 txnclose hook: HG_PHASES_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=commit (glob)
45 45
46 46 $ hg unbundle $TESTDIR/bundles/rebase.hg
47 47 adding changesets
48 48 adding manifests
49 49 adding file changes
50 50 added 8 changesets with 7 changes to 7 files (+3 heads)
51 51 pre-close-tip:02de42196ebe draft
52 52 postclose-tip:02de42196ebe draft
53 53 txnclose hook: HG_NODE=cd010b8cd998f3981a5a8115f94f8da4ab506089 HG_PHASES_MOVED=1 HG_SOURCE=unbundle HG_TXNID=TXN:* HG_TXNNAME=unbundle (glob)
54 54 bundle:*/tests/bundles/rebase.hg HG_URL=bundle:*/tests/bundles/rebase.hg (glob)
55 55 (run 'hg heads' to see heads, 'hg merge' to merge)
56 56
57 57 $ cd ..
58 58
59 59 Real world exchange
60 60 =====================
61 61
62 62 Add more obsolescence information
63 63
64 64 $ hg -R main debugobsolete -d '0 0' 1111111111111111111111111111111111111111 `getmainid 9520eea781bc`
65 65 pre-close-tip:02de42196ebe draft
66 66 postclose-tip:02de42196ebe draft
67 67 txnclose hook: HG_NEW_OBSMARKERS=1 HG_TXNID=TXN:* HG_TXNNAME=debugobsolete (glob)
68 68 $ hg -R main debugobsolete -d '0 0' 2222222222222222222222222222222222222222 `getmainid 24b6387c8c8c`
69 69 pre-close-tip:02de42196ebe draft
70 70 postclose-tip:02de42196ebe draft
71 71 txnclose hook: HG_NEW_OBSMARKERS=1 HG_TXNID=TXN:* HG_TXNNAME=debugobsolete (glob)
72 72
73 73 clone --pull
74 74
75 75 $ hg -R main phase --public cd010b8cd998
76 76 pre-close-tip:02de42196ebe draft
77 77 postclose-tip:02de42196ebe draft
78 78 txnclose hook: HG_PHASES_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=phase (glob)
79 79 $ hg clone main other --pull --rev 9520eea781bc
80 80 adding changesets
81 81 adding manifests
82 82 adding file changes
83 83 added 2 changesets with 2 changes to 2 files
84 84 1 new obsolescence markers
85 85 pre-close-tip:9520eea781bc draft
86 86 postclose-tip:9520eea781bc draft
87 87 txnclose hook: HG_NEW_OBSMARKERS=1 HG_NODE=cd010b8cd998f3981a5a8115f94f8da4ab506089 HG_PHASES_MOVED=1 HG_SOURCE=pull HG_TXNID=TXN:* HG_TXNNAME=pull (glob)
88 88 file:/*/$TESTTMP/main HG_URL=file:$TESTTMP/main (glob)
89 89 updating to branch default
90 90 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
91 91 $ hg -R other log -G
92 92 @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E
93 93 |
94 94 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
95 95
96 96 $ hg -R other debugobsolete
97 97 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
98 98
99 99 pull
100 100
101 101 $ hg -R main phase --public 9520eea781bc
102 102 pre-close-tip:02de42196ebe draft
103 103 postclose-tip:02de42196ebe draft
104 104 txnclose hook: HG_PHASES_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=phase (glob)
105 105 $ hg -R other pull -r 24b6387c8c8c
106 106 pulling from $TESTTMP/main (glob)
107 107 searching for changes
108 108 adding changesets
109 109 adding manifests
110 110 adding file changes
111 111 added 1 changesets with 1 changes to 1 files (+1 heads)
112 112 1 new obsolescence markers
113 113 pre-close-tip:24b6387c8c8c draft
114 114 postclose-tip:24b6387c8c8c draft
115 115 txnclose hook: HG_NEW_OBSMARKERS=1 HG_NODE=24b6387c8c8cae37178880f3fa95ded3cb1cf785 HG_PHASES_MOVED=1 HG_SOURCE=pull HG_TXNID=TXN:* HG_TXNNAME=pull (glob)
116 116 file:/*/$TESTTMP/main HG_URL=file:$TESTTMP/main (glob)
117 117 (run 'hg heads' to see heads, 'hg merge' to merge)
118 118 $ hg -R other log -G
119 119 o 2:24b6387c8c8c draft Nicolas Dumazet <nicdumz.commits@gmail.com> F
120 120 |
121 121 | @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E
122 122 |/
123 123 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
124 124
125 125 $ hg -R other debugobsolete
126 126 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
127 127 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
128 128
129 129 pull empty (with phase movement)
130 130
131 131 $ hg -R main phase --public 24b6387c8c8c
132 132 pre-close-tip:02de42196ebe draft
133 133 postclose-tip:02de42196ebe draft
134 134 txnclose hook: HG_PHASES_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=phase (glob)
135 135 $ hg -R other pull -r 24b6387c8c8c
136 136 pulling from $TESTTMP/main (glob)
137 137 no changes found
138 138 pre-close-tip:24b6387c8c8c public
139 139 postclose-tip:24b6387c8c8c public
140 140 txnclose hook: HG_NEW_OBSMARKERS=0 HG_PHASES_MOVED=1 HG_SOURCE=pull HG_TXNID=TXN:* HG_TXNNAME=pull (glob)
141 141 file:/*/$TESTTMP/main HG_URL=file:$TESTTMP/main (glob)
142 142 $ hg -R other log -G
143 143 o 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
144 144 |
145 145 | @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E
146 146 |/
147 147 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
148 148
149 149 $ hg -R other debugobsolete
150 150 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
151 151 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
152 152
153 153 pull empty
154 154
155 155 $ hg -R other pull -r 24b6387c8c8c
156 156 pulling from $TESTTMP/main (glob)
157 157 no changes found
158 158 pre-close-tip:24b6387c8c8c public
159 159 postclose-tip:24b6387c8c8c public
160 160 txnclose hook: HG_NEW_OBSMARKERS=0 HG_SOURCE=pull HG_TXNID=TXN:* HG_TXNNAME=pull (glob)
161 161 file:/*/$TESTTMP/main HG_URL=file:$TESTTMP/main (glob)
162 162 $ hg -R other log -G
163 163 o 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
164 164 |
165 165 | @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E
166 166 |/
167 167 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
168 168
169 169 $ hg -R other debugobsolete
170 170 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
171 171 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
172 172
173 173 add extra data to test their exchange during push
174 174
175 175 $ hg -R main bookmark --rev eea13746799a book_eea1
176 176 $ hg -R main debugobsolete -d '0 0' 3333333333333333333333333333333333333333 `getmainid eea13746799a`
177 177 pre-close-tip:02de42196ebe draft
178 178 postclose-tip:02de42196ebe draft
179 179 txnclose hook: HG_NEW_OBSMARKERS=1 HG_TXNID=TXN:* HG_TXNNAME=debugobsolete (glob)
180 180 $ hg -R main bookmark --rev 02de42196ebe book_02de
181 181 $ hg -R main debugobsolete -d '0 0' 4444444444444444444444444444444444444444 `getmainid 02de42196ebe`
182 182 pre-close-tip:02de42196ebe draft book_02de
183 183 postclose-tip:02de42196ebe draft book_02de
184 184 txnclose hook: HG_NEW_OBSMARKERS=1 HG_TXNID=TXN:* HG_TXNNAME=debugobsolete (glob)
185 185 $ hg -R main bookmark --rev 42ccdea3bb16 book_42cc
186 186 $ hg -R main debugobsolete -d '0 0' 5555555555555555555555555555555555555555 `getmainid 42ccdea3bb16`
187 187 pre-close-tip:02de42196ebe draft book_02de
188 188 postclose-tip:02de42196ebe draft book_02de
189 189 txnclose hook: HG_NEW_OBSMARKERS=1 HG_TXNID=TXN:* HG_TXNNAME=debugobsolete (glob)
190 190 $ hg -R main bookmark --rev 5fddd98957c8 book_5fdd
191 191 $ hg -R main debugobsolete -d '0 0' 6666666666666666666666666666666666666666 `getmainid 5fddd98957c8`
192 192 pre-close-tip:02de42196ebe draft book_02de
193 193 postclose-tip:02de42196ebe draft book_02de
194 194 txnclose hook: HG_NEW_OBSMARKERS=1 HG_TXNID=TXN:* HG_TXNNAME=debugobsolete (glob)
195 195 $ hg -R main bookmark --rev 32af7686d403 book_32af
196 196 $ hg -R main debugobsolete -d '0 0' 7777777777777777777777777777777777777777 `getmainid 32af7686d403`
197 197 pre-close-tip:02de42196ebe draft book_02de
198 198 postclose-tip:02de42196ebe draft book_02de
199 199 txnclose hook: HG_NEW_OBSMARKERS=1 HG_TXNID=TXN:* HG_TXNNAME=debugobsolete (glob)
200 200
201 201 $ hg -R other bookmark --rev cd010b8cd998 book_eea1
202 202 $ hg -R other bookmark --rev cd010b8cd998 book_02de
203 203 $ hg -R other bookmark --rev cd010b8cd998 book_42cc
204 204 $ hg -R other bookmark --rev cd010b8cd998 book_5fdd
205 205 $ hg -R other bookmark --rev cd010b8cd998 book_32af
206 206
207 207 $ hg -R main phase --public eea13746799a
208 208 pre-close-tip:02de42196ebe draft book_02de
209 209 postclose-tip:02de42196ebe draft book_02de
210 210 txnclose hook: HG_PHASES_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=phase (glob)
211 211
212 212 push
213 213 $ hg -R main push other --rev eea13746799a --bookmark book_eea1
214 214 pushing to other
215 215 searching for changes
216 216 remote: adding changesets
217 217 remote: adding manifests
218 218 remote: adding file changes
219 219 remote: added 1 changesets with 0 changes to 0 files (-1 heads)
220 220 remote: 1 new obsolescence markers
221 221 remote: pre-close-tip:eea13746799a public book_eea1
222 222 remote: pushkey: lock state after "phases"
223 223 remote: lock: free
224 224 remote: wlock: free
225 225 remote: pushkey: lock state after "bookmarks"
226 226 remote: lock: free
227 227 remote: wlock: free
228 228 remote: postclose-tip:eea13746799a public book_eea1
229 229 remote: txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_NEW_OBSMARKERS=1 HG_NODE=eea13746799a9e0bfd88f29d3c2e9dc9389f524f HG_PHASES_MOVED=1 HG_SOURCE=push HG_TXNID=TXN:* HG_TXNNAME=push HG_URL=push (glob)
230 230 updating bookmark book_eea1
231 231 pre-close-tip:02de42196ebe draft book_02de
232 232 postclose-tip:02de42196ebe draft book_02de
233 233 txnclose hook: HG_SOURCE=push-response HG_TXNID=TXN:* HG_TXNNAME=push-response (glob)
234 234 file:/*/$TESTTMP/other HG_URL=file:$TESTTMP/other (glob)
235 235 $ hg -R other log -G
236 236 o 3:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> book_eea1 G
237 237 |\
238 238 | o 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
239 239 | |
240 240 @ | 1:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E
241 241 |/
242 242 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_02de book_32af book_42cc book_5fdd A
243 243
244 244 $ hg -R other debugobsolete
245 245 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
246 246 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
247 247 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
248 248
249 249 pull over ssh
250 250
251 251 $ hg -R other pull ssh://user@dummy/main -r 02de42196ebe --bookmark book_02de
252 252 pulling from ssh://user@dummy/main
253 253 searching for changes
254 254 adding changesets
255 255 adding manifests
256 256 adding file changes
257 257 added 1 changesets with 1 changes to 1 files (+1 heads)
258 258 1 new obsolescence markers
259 259 updating bookmark book_02de
260 260 pre-close-tip:02de42196ebe draft book_02de
261 261 postclose-tip:02de42196ebe draft book_02de
262 262 txnclose hook: HG_BOOKMARK_MOVED=1 HG_NEW_OBSMARKERS=1 HG_NODE=02de42196ebee42ef284b6780a87cdc96e8eaab6 HG_PHASES_MOVED=1 HG_SOURCE=pull HG_TXNID=TXN:* HG_TXNNAME=pull (glob)
263 263 ssh://user@dummy/main HG_URL=ssh://user@dummy/main
264 264 (run 'hg heads' to see heads, 'hg merge' to merge)
265 265 $ hg -R other debugobsolete
266 266 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
267 267 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
268 268 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
269 269 4444444444444444444444444444444444444444 02de42196ebee42ef284b6780a87cdc96e8eaab6 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
270 270
271 271 pull over http
272 272
273 273 $ hg -R main serve -p $HGPORT -d --pid-file=main.pid -E main-error.log
274 274 $ cat main.pid >> $DAEMON_PIDS
275 275
276 276 $ hg -R other pull http://localhost:$HGPORT/ -r 42ccdea3bb16 --bookmark book_42cc
277 277 pulling from http://localhost:$HGPORT/
278 278 searching for changes
279 279 adding changesets
280 280 adding manifests
281 281 adding file changes
282 282 added 1 changesets with 1 changes to 1 files (+1 heads)
283 283 1 new obsolescence markers
284 284 updating bookmark book_42cc
285 285 pre-close-tip:42ccdea3bb16 draft book_42cc
286 286 postclose-tip:42ccdea3bb16 draft book_42cc
287 287 txnclose hook: HG_BOOKMARK_MOVED=1 HG_NEW_OBSMARKERS=1 HG_NODE=42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 HG_PHASES_MOVED=1 HG_SOURCE=pull HG_TXNID=TXN:* HG_TXNNAME=pull (glob)
288 288 http://localhost:$HGPORT/ HG_URL=http://localhost:$HGPORT/
289 289 (run 'hg heads .' to see heads, 'hg merge' to merge)
290 290 $ cat main-error.log
291 291 $ hg -R other debugobsolete
292 292 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
293 293 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
294 294 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
295 295 4444444444444444444444444444444444444444 02de42196ebee42ef284b6780a87cdc96e8eaab6 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
296 296 5555555555555555555555555555555555555555 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
297 297
298 298 push over ssh
299 299
300 300 $ hg -R main push ssh://user@dummy/other -r 5fddd98957c8 --bookmark book_5fdd
301 301 pushing to ssh://user@dummy/other
302 302 searching for changes
303 303 remote: adding changesets
304 304 remote: adding manifests
305 305 remote: adding file changes
306 306 remote: added 1 changesets with 1 changes to 1 files
307 307 remote: 1 new obsolescence markers
308 308 remote: pre-close-tip:5fddd98957c8 draft book_5fdd
309 309 remote: pushkey: lock state after "bookmarks"
310 310 remote: lock: free
311 311 remote: wlock: free
312 312 remote: postclose-tip:5fddd98957c8 draft book_5fdd
313 313 remote: txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_NEW_OBSMARKERS=1 HG_NODE=5fddd98957c8a54a4d436dfe1da9d87f21a1b97b HG_SOURCE=serve HG_TXNID=TXN:* HG_TXNNAME=serve HG_URL=remote:ssh:127.0.0.1 (glob)
314 314 updating bookmark book_5fdd
315 315 pre-close-tip:02de42196ebe draft book_02de
316 316 postclose-tip:02de42196ebe draft book_02de
317 317 txnclose hook: HG_SOURCE=push-response HG_TXNID=TXN:* HG_TXNNAME=push-response (glob)
318 318 ssh://user@dummy/other HG_URL=ssh://user@dummy/other
319 319 $ hg -R other log -G
320 320 o 6:5fddd98957c8 draft Nicolas Dumazet <nicdumz.commits@gmail.com> book_5fdd C
321 321 |
322 322 o 5:42ccdea3bb16 draft Nicolas Dumazet <nicdumz.commits@gmail.com> book_42cc B
323 323 |
324 324 | o 4:02de42196ebe draft Nicolas Dumazet <nicdumz.commits@gmail.com> book_02de H
325 325 | |
326 326 | | o 3:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> book_eea1 G
327 327 | |/|
328 328 | o | 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
329 329 |/ /
330 330 | @ 1:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E
331 331 |/
332 332 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_32af A
333 333
334 334 $ hg -R other debugobsolete
335 335 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
336 336 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
337 337 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
338 338 4444444444444444444444444444444444444444 02de42196ebee42ef284b6780a87cdc96e8eaab6 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
339 339 5555555555555555555555555555555555555555 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
340 340 6666666666666666666666666666666666666666 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
341 341
342 342 push over http
343 343
344 344 $ hg -R other serve -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
345 345 $ cat other.pid >> $DAEMON_PIDS
346 346
347 347 $ hg -R main phase --public 32af7686d403
348 348 pre-close-tip:02de42196ebe draft book_02de
349 349 postclose-tip:02de42196ebe draft book_02de
350 350 txnclose hook: HG_PHASES_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=phase (glob)
351 351 $ hg -R main push http://localhost:$HGPORT2/ -r 32af7686d403 --bookmark book_32af
352 352 pushing to http://localhost:$HGPORT2/
353 353 searching for changes
354 354 remote: adding changesets
355 355 remote: adding manifests
356 356 remote: adding file changes
357 357 remote: added 1 changesets with 1 changes to 1 files
358 358 remote: 1 new obsolescence markers
359 359 remote: pre-close-tip:32af7686d403 public book_32af
360 360 remote: pushkey: lock state after "phases"
361 361 remote: lock: free
362 362 remote: wlock: free
363 363 remote: pushkey: lock state after "bookmarks"
364 364 remote: lock: free
365 365 remote: wlock: free
366 366 remote: postclose-tip:32af7686d403 public book_32af
367 367 remote: txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_NEW_OBSMARKERS=1 HG_NODE=32af7686d403cf45b5d95f2d70cebea587ac806a HG_PHASES_MOVED=1 HG_SOURCE=serve HG_TXNID=TXN:* HG_TXNNAME=serve HG_URL=remote:http:127.0.0.1: (glob)
368 368 updating bookmark book_32af
369 369 pre-close-tip:02de42196ebe draft book_02de
370 370 postclose-tip:02de42196ebe draft book_02de
371 371 txnclose hook: HG_SOURCE=push-response HG_TXNID=TXN:* HG_TXNNAME=push-response (glob)
372 372 http://localhost:$HGPORT2/ HG_URL=http://localhost:$HGPORT2/
373 373 $ cat other-error.log
374 374
375 375 Check final content.
376 376
377 377 $ hg -R other log -G
378 378 o 7:32af7686d403 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_32af D
379 379 |
380 380 o 6:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_5fdd C
381 381 |
382 382 o 5:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_42cc B
383 383 |
384 384 | o 4:02de42196ebe draft Nicolas Dumazet <nicdumz.commits@gmail.com> book_02de H
385 385 | |
386 386 | | o 3:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> book_eea1 G
387 387 | |/|
388 388 | o | 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
389 389 |/ /
390 390 | @ 1:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E
391 391 |/
392 392 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
393 393
394 394 $ hg -R other debugobsolete
395 395 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
396 396 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
397 397 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
398 398 4444444444444444444444444444444444444444 02de42196ebee42ef284b6780a87cdc96e8eaab6 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
399 399 5555555555555555555555555555555555555555 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
400 400 6666666666666666666666666666666666666666 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
401 401 7777777777777777777777777777777777777777 32af7686d403cf45b5d95f2d70cebea587ac806a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
402 402
403 403 (check that no 'pending' files remain)
404 404
405 405 $ ls -1 other/.hg/bookmarks*
406 406 other/.hg/bookmarks
407 407 $ ls -1 other/.hg/store/phaseroots*
408 408 other/.hg/store/phaseroots
409 409 $ ls -1 other/.hg/store/00changelog.i*
410 410 other/.hg/store/00changelog.i
411 411
412 412 Error Handling
413 413 ==============
414 414
415 415 Check that errors are properly returned to the client during push.
416 416
417 417 Setting up
418 418
419 419 $ cat > failpush.py << EOF
420 420 > """A small extension that makes push fails when using bundle2
421 421 >
422 422 > used to test error handling in bundle2
423 423 > """
424 424 >
425 425 > from mercurial import util
426 426 > from mercurial import bundle2
427 427 > from mercurial import exchange
428 428 > from mercurial import extensions
429 429 >
430 430 > def _pushbundle2failpart(pushop, bundler):
431 431 > reason = pushop.ui.config('failpush', 'reason', None)
432 432 > part = None
433 433 > if reason == 'abort':
434 434 > bundler.newpart('test:abort')
435 435 > if reason == 'unknown':
436 436 > bundler.newpart('test:unknown')
437 437 > if reason == 'race':
438 438 > # 20 Bytes of crap
439 439 > bundler.newpart('check:heads', data='01234567890123456789')
440 440 >
441 441 > @bundle2.parthandler("test:abort")
442 442 > def handleabort(op, part):
443 443 > raise util.Abort('Abandon ship!', hint="don't panic")
444 444 >
445 445 > def uisetup(ui):
446 446 > exchange.b2partsgenmapping['failpart'] = _pushbundle2failpart
447 447 > exchange.b2partsgenorder.insert(0, 'failpart')
448 448 >
449 449 > EOF
450 450
451 451 $ cd main
452 452 $ hg up tip
453 453 3 files updated, 0 files merged, 1 files removed, 0 files unresolved
454 454 $ echo 'I' > I
455 455 $ hg add I
456 456 $ hg ci -m 'I'
457 457 pre-close-tip:e7ec4e813ba6 draft
458 458 postclose-tip:e7ec4e813ba6 draft
459 459 txnclose hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob)
460 460 $ hg id
461 461 e7ec4e813ba6 tip
462 462 $ cd ..
463 463
464 464 $ cat << EOF >> $HGRCPATH
465 465 > [extensions]
466 466 > failpush=$TESTTMP/failpush.py
467 467 > EOF
468 468
469 469 $ killdaemons.py
470 470 $ hg -R other serve -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
471 471 $ cat other.pid >> $DAEMON_PIDS
472 472
473 473 Doing the actual push: Abort error
474 474
475 475 $ cat << EOF >> $HGRCPATH
476 476 > [failpush]
477 477 > reason = abort
478 478 > EOF
479 479
480 480 $ hg -R main push other -r e7ec4e813ba6
481 481 pushing to other
482 482 searching for changes
483 483 abort: Abandon ship!
484 484 (don't panic)
485 485 [255]
486 486
487 487 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
488 488 pushing to ssh://user@dummy/other
489 489 searching for changes
490 490 abort: Abandon ship!
491 491 (don't panic)
492 492 [255]
493 493
494 494 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
495 495 pushing to http://localhost:$HGPORT2/
496 496 searching for changes
497 497 abort: Abandon ship!
498 498 (don't panic)
499 499 [255]
500 500
501 501
502 502 Doing the actual push: unknown mandatory parts
503 503
504 504 $ cat << EOF >> $HGRCPATH
505 505 > [failpush]
506 506 > reason = unknown
507 507 > EOF
508 508
509 509 $ hg -R main push other -r e7ec4e813ba6
510 510 pushing to other
511 511 searching for changes
512 512 abort: missing support for test:unknown
513 513 [255]
514 514
515 515 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
516 516 pushing to ssh://user@dummy/other
517 517 searching for changes
518 518 abort: missing support for test:unknown
519 519 [255]
520 520
521 521 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
522 522 pushing to http://localhost:$HGPORT2/
523 523 searching for changes
524 524 abort: missing support for test:unknown
525 525 [255]
526 526
527 527 Doing the actual push: race
528 528
529 529 $ cat << EOF >> $HGRCPATH
530 530 > [failpush]
531 531 > reason = race
532 532 > EOF
533 533
534 534 $ hg -R main push other -r e7ec4e813ba6
535 535 pushing to other
536 536 searching for changes
537 537 abort: push failed:
538 538 'repository changed while pushing - please try again'
539 539 [255]
540 540
541 541 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
542 542 pushing to ssh://user@dummy/other
543 543 searching for changes
544 544 abort: push failed:
545 545 'repository changed while pushing - please try again'
546 546 [255]
547 547
548 548 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
549 549 pushing to http://localhost:$HGPORT2/
550 550 searching for changes
551 551 abort: push failed:
552 552 'repository changed while pushing - please try again'
553 553 [255]
554 554
555 555 Doing the actual push: hook abort
556 556
557 557 $ cat << EOF >> $HGRCPATH
558 558 > [failpush]
559 559 > reason =
560 560 > [hooks]
561 561 > pretxnclose.failpush = sh -c "echo 'You shall not pass!'; false"
562 562 > txnabort.failpush = sh -c "echo 'Cleaning up the mess...'"
563 563 > EOF
564 564
565 565 $ killdaemons.py
566 566 $ hg -R other serve -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
567 567 $ cat other.pid >> $DAEMON_PIDS
568 568
569 569 $ hg -R main push other -r e7ec4e813ba6
570 570 pushing to other
571 571 searching for changes
572 572 remote: adding changesets
573 573 remote: adding manifests
574 574 remote: adding file changes
575 575 remote: added 1 changesets with 1 changes to 1 files
576 576 remote: pre-close-tip:e7ec4e813ba6 draft
577 577 remote: You shall not pass!
578 578 remote: transaction abort!
579 579 remote: Cleaning up the mess...
580 580 remote: rollback completed
581 581 abort: pretxnclose.failpush hook exited with status 1
582 582 [255]
583 583
584 584 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
585 585 pushing to ssh://user@dummy/other
586 586 searching for changes
587 587 remote: adding changesets
588 588 remote: adding manifests
589 589 remote: adding file changes
590 590 remote: added 1 changesets with 1 changes to 1 files
591 591 remote: pre-close-tip:e7ec4e813ba6 draft
592 592 remote: You shall not pass!
593 593 remote: transaction abort!
594 594 remote: Cleaning up the mess...
595 595 remote: rollback completed
596 596 abort: pretxnclose.failpush hook exited with status 1
597 597 [255]
598 598
599 599 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
600 600 pushing to http://localhost:$HGPORT2/
601 601 searching for changes
602 602 remote: adding changesets
603 603 remote: adding manifests
604 604 remote: adding file changes
605 605 remote: added 1 changesets with 1 changes to 1 files
606 606 remote: pre-close-tip:e7ec4e813ba6 draft
607 607 remote: You shall not pass!
608 608 remote: transaction abort!
609 609 remote: Cleaning up the mess...
610 610 remote: rollback completed
611 611 abort: pretxnclose.failpush hook exited with status 1
612 612 [255]
613 613
614 614 (check that no 'pending' files remain)
615 615
616 616 $ ls -1 other/.hg/bookmarks*
617 617 other/.hg/bookmarks
618 618 $ ls -1 other/.hg/store/phaseroots*
619 619 other/.hg/store/phaseroots
620 620 $ ls -1 other/.hg/store/00changelog.i*
621 621 other/.hg/store/00changelog.i
622 622
623 623 Check error from hook during the unbundling process itself
624 624
625 625 $ cat << EOF >> $HGRCPATH
626 626 > pretxnchangegroup = sh -c "echo 'Fail early!'; false"
627 627 > EOF
628 628 $ killdaemons.py # reload http config
629 629 $ hg -R other serve -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
630 630 $ cat other.pid >> $DAEMON_PIDS
631 631
632 632 $ hg -R main push other -r e7ec4e813ba6
633 633 pushing to other
634 634 searching for changes
635 635 remote: adding changesets
636 636 remote: adding manifests
637 637 remote: adding file changes
638 638 remote: added 1 changesets with 1 changes to 1 files
639 639 remote: Fail early!
640 640 remote: transaction abort!
641 641 remote: Cleaning up the mess...
642 642 remote: rollback completed
643 643 abort: pretxnchangegroup hook exited with status 1
644 644 [255]
645 645 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
646 646 pushing to ssh://user@dummy/other
647 647 searching for changes
648 648 remote: adding changesets
649 649 remote: adding manifests
650 650 remote: adding file changes
651 651 remote: added 1 changesets with 1 changes to 1 files
652 652 remote: Fail early!
653 653 remote: transaction abort!
654 654 remote: Cleaning up the mess...
655 655 remote: rollback completed
656 656 abort: pretxnchangegroup hook exited with status 1
657 657 [255]
658 658 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
659 659 pushing to http://localhost:$HGPORT2/
660 660 searching for changes
661 661 remote: adding changesets
662 662 remote: adding manifests
663 663 remote: adding file changes
664 664 remote: added 1 changesets with 1 changes to 1 files
665 665 remote: Fail early!
666 666 remote: transaction abort!
667 667 remote: Cleaning up the mess...
668 668 remote: rollback completed
669 669 abort: pretxnchangegroup hook exited with status 1
670 670 [255]
671 671
672 672 Check output capture control.
673 673
674 674 (should be still forced for http, disabled for local and ssh)
675 675
676 676 $ cat >> $HGRCPATH << EOF
677 677 > [experimental]
678 678 > bundle2-output-capture=False
679 679 > EOF
680 680
681 681 $ hg -R main push other -r e7ec4e813ba6
682 682 pushing to other
683 683 searching for changes
684 684 adding changesets
685 685 adding manifests
686 686 adding file changes
687 687 added 1 changesets with 1 changes to 1 files
688 688 Fail early!
689 689 transaction abort!
690 690 Cleaning up the mess...
691 691 rollback completed
692 692 abort: pretxnchangegroup hook exited with status 1
693 693 [255]
694 694 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
695 695 pushing to ssh://user@dummy/other
696 696 searching for changes
697 697 remote: adding changesets
698 698 remote: adding manifests
699 699 remote: adding file changes
700 700 remote: added 1 changesets with 1 changes to 1 files
701 701 remote: Fail early!
702 702 remote: transaction abort!
703 703 remote: Cleaning up the mess...
704 704 remote: rollback completed
705 705 abort: pretxnchangegroup hook exited with status 1
706 706 [255]
707 707 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
708 708 pushing to http://localhost:$HGPORT2/
709 709 searching for changes
710 710 remote: adding changesets
711 711 remote: adding manifests
712 712 remote: adding file changes
713 713 remote: added 1 changesets with 1 changes to 1 files
714 714 remote: Fail early!
715 715 remote: transaction abort!
716 716 remote: Cleaning up the mess...
717 717 remote: rollback completed
718 718 abort: pretxnchangegroup hook exited with status 1
719 719 [255]
@@ -1,854 +1,854 b''
1 1 This test is dedicated to test the bundle2 container format
2 2
3 3 It test multiple existing parts to test different feature of the container. You
4 4 probably do not need to touch this test unless you change the binary encoding
5 5 of the bundle2 format itself.
6 6
7 7 Create an extension to test bundle2 API
8 8
9 9 $ cat > bundle2.py << EOF
10 10 > """A small extension to test bundle2 implementation
11 11 >
12 12 > Current bundle2 implementation is far too limited to be used in any core
13 13 > code. We still need to be able to test it while it grow up.
14 14 > """
15 15 >
16 16 > import sys, os
17 17 > from mercurial import cmdutil
18 18 > from mercurial import util
19 19 > from mercurial import bundle2
20 20 > from mercurial import scmutil
21 21 > from mercurial import discovery
22 22 > from mercurial import changegroup
23 23 > from mercurial import error
24 24 > from mercurial import obsolete
25 25 >
26 26 >
27 27 > try:
28 28 > import msvcrt
29 29 > msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY)
30 30 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
31 31 > msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
32 32 > except ImportError:
33 33 > pass
34 34 >
35 35 > cmdtable = {}
36 36 > command = cmdutil.command(cmdtable)
37 37 >
38 38 > ELEPHANTSSONG = """Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko
39 39 > Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko
40 40 > Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko."""
41 41 > assert len(ELEPHANTSSONG) == 178 # future test say 178 bytes, trust it.
42 42 >
43 43 > @bundle2.parthandler('test:song')
44 44 > def songhandler(op, part):
45 45 > """handle a "test:song" bundle2 part, printing the lyrics on stdin"""
46 46 > op.ui.write('The choir starts singing:\n')
47 47 > verses = 0
48 48 > for line in part.read().split('\n'):
49 49 > op.ui.write(' %s\n' % line)
50 50 > verses += 1
51 51 > op.records.add('song', {'verses': verses})
52 52 >
53 53 > @bundle2.parthandler('test:ping')
54 54 > def pinghandler(op, part):
55 55 > op.ui.write('received ping request (id %i)\n' % part.id)
56 56 > if op.reply is not None and 'ping-pong' in op.reply.capabilities:
57 57 > op.ui.write_err('replying to ping request (id %i)\n' % part.id)
58 58 > op.reply.newpart('test:pong', [('in-reply-to', str(part.id))],
59 59 > mandatory=False)
60 60 >
61 61 > @bundle2.parthandler('test:debugreply')
62 62 > def debugreply(op, part):
63 63 > """print data about the capacity of the bundle reply"""
64 64 > if op.reply is None:
65 65 > op.ui.write('debugreply: no reply\n')
66 66 > else:
67 67 > op.ui.write('debugreply: capabilities:\n')
68 68 > for cap in sorted(op.reply.capabilities):
69 69 > op.ui.write('debugreply: %r\n' % cap)
70 70 > for val in op.reply.capabilities[cap]:
71 71 > op.ui.write('debugreply: %r\n' % val)
72 72 >
73 73 > @command('bundle2',
74 74 > [('', 'param', [], 'stream level parameter'),
75 75 > ('', 'unknown', False, 'include an unknown mandatory part in the bundle'),
76 76 > ('', 'unknownparams', False, 'include an unknown part parameters in the bundle'),
77 77 > ('', 'parts', False, 'include some arbitrary parts to the bundle'),
78 78 > ('', 'reply', False, 'produce a reply bundle'),
79 79 > ('', 'pushrace', False, 'includes a check:head part with unknown nodes'),
80 80 > ('', 'genraise', False, 'includes a part that raise an exception during generation'),
81 81 > ('r', 'rev', [], 'includes those changeset in the bundle'),],
82 82 > '[OUTPUTFILE]')
83 83 > def cmdbundle2(ui, repo, path=None, **opts):
84 84 > """write a bundle2 container on standard output"""
85 85 > bundler = bundle2.bundle20(ui)
86 86 > for p in opts['param']:
87 87 > p = p.split('=', 1)
88 88 > try:
89 89 > bundler.addparam(*p)
90 90 > except ValueError, exc:
91 91 > raise util.Abort('%s' % exc)
92 92 >
93 93 > if opts['reply']:
94 94 > capsstring = 'ping-pong\nelephants=babar,celeste\ncity%3D%21=celeste%2Cville'
95 95 > bundler.newpart('replycaps', data=capsstring)
96 96 >
97 97 > if opts['pushrace']:
98 98 > # also serve to test the assignement of data outside of init
99 99 > part = bundler.newpart('check:heads')
100 100 > part.data = '01234567890123456789'
101 101 >
102 102 > revs = opts['rev']
103 103 > if 'rev' in opts:
104 104 > revs = scmutil.revrange(repo, opts['rev'])
105 105 > if revs:
106 106 > # very crude version of a changegroup part creation
107 107 > bundled = repo.revs('%ld::%ld', revs, revs)
108 108 > headmissing = [c.node() for c in repo.set('heads(%ld)', revs)]
109 109 > headcommon = [c.node() for c in repo.set('parents(%ld) - %ld', revs, revs)]
110 110 > outgoing = discovery.outgoing(repo.changelog, headcommon, headmissing)
111 111 > cg = changegroup.getlocalchangegroup(repo, 'test:bundle2', outgoing, None)
112 112 > bundler.newpart('changegroup', data=cg.getchunks(),
113 113 > mandatory=False)
114 114 >
115 115 > if opts['parts']:
116 116 > bundler.newpart('test:empty', mandatory=False)
117 117 > # add a second one to make sure we handle multiple parts
118 118 > bundler.newpart('test:empty', mandatory=False)
119 119 > bundler.newpart('test:song', data=ELEPHANTSSONG, mandatory=False)
120 120 > bundler.newpart('test:debugreply', mandatory=False)
121 121 > mathpart = bundler.newpart('test:math')
122 122 > mathpart.addparam('pi', '3.14')
123 123 > mathpart.addparam('e', '2.72')
124 124 > mathpart.addparam('cooking', 'raw', mandatory=False)
125 125 > mathpart.data = '42'
126 126 > mathpart.mandatory = False
127 127 > # advisory known part with unknown mandatory param
128 128 > bundler.newpart('test:song', [('randomparam','')], mandatory=False)
129 129 > if opts['unknown']:
130 130 > bundler.newpart('test:unknown', data='some random content')
131 131 > if opts['unknownparams']:
132 132 > bundler.newpart('test:song', [('randomparams', '')])
133 133 > if opts['parts']:
134 134 > bundler.newpart('test:ping', mandatory=False)
135 135 > if opts['genraise']:
136 136 > def genraise():
137 137 > yield 'first line\n'
138 138 > raise RuntimeError('Someone set up us the bomb!')
139 139 > bundler.newpart('output', data=genraise(), mandatory=False)
140 140 >
141 141 > if path is None:
142 142 > file = sys.stdout
143 143 > else:
144 144 > file = open(path, 'wb')
145 145 >
146 146 > try:
147 147 > for chunk in bundler.getchunks():
148 148 > file.write(chunk)
149 149 > except RuntimeError, exc:
150 150 > raise util.Abort(exc)
151 151 >
152 152 > @command('unbundle2', [], '')
153 153 > def cmdunbundle2(ui, repo, replypath=None):
154 154 > """process a bundle2 stream from stdin on the current repo"""
155 155 > try:
156 156 > tr = None
157 157 > lock = repo.lock()
158 158 > tr = repo.transaction('processbundle')
159 159 > try:
160 160 > unbundler = bundle2.getunbundler(ui, sys.stdin)
161 161 > op = bundle2.processbundle(repo, unbundler, lambda: tr)
162 162 > tr.close()
163 163 > except error.BundleValueError, exc:
164 164 > raise util.Abort('missing support for %s' % exc)
165 165 > except error.PushRaced, exc:
166 166 > raise util.Abort('push race: %s' % exc)
167 167 > finally:
168 168 > if tr is not None:
169 169 > tr.release()
170 170 > lock.release()
171 171 > remains = sys.stdin.read()
172 172 > ui.write('%i unread bytes\n' % len(remains))
173 173 > if op.records['song']:
174 174 > totalverses = sum(r['verses'] for r in op.records['song'])
175 175 > ui.write('%i total verses sung\n' % totalverses)
176 176 > for rec in op.records['changegroup']:
177 177 > ui.write('addchangegroup return: %i\n' % rec['return'])
178 178 > if op.reply is not None and replypath is not None:
179 179 > file = open(replypath, 'wb')
180 180 > for chunk in op.reply.getchunks():
181 181 > file.write(chunk)
182 182 >
183 183 > @command('statbundle2', [], '')
184 184 > def cmdstatbundle2(ui, repo):
185 185 > """print statistic on the bundle2 container read from stdin"""
186 186 > unbundler = bundle2.getunbundler(ui, sys.stdin)
187 187 > try:
188 188 > params = unbundler.params
189 189 > except error.BundleValueError, exc:
190 190 > raise util.Abort('unknown parameters: %s' % exc)
191 191 > ui.write('options count: %i\n' % len(params))
192 192 > for key in sorted(params):
193 193 > ui.write('- %s\n' % key)
194 194 > value = params[key]
195 195 > if value is not None:
196 196 > ui.write(' %s\n' % value)
197 197 > count = 0
198 198 > for p in unbundler.iterparts():
199 199 > count += 1
200 200 > ui.write(' :%s:\n' % p.type)
201 201 > ui.write(' mandatory: %i\n' % len(p.mandatoryparams))
202 202 > ui.write(' advisory: %i\n' % len(p.advisoryparams))
203 203 > ui.write(' payload: %i bytes\n' % len(p.read()))
204 204 > ui.write('parts count: %i\n' % count)
205 205 > EOF
206 206 $ cat >> $HGRCPATH << EOF
207 207 > [extensions]
208 208 > bundle2=$TESTTMP/bundle2.py
209 209 > [experimental]
210 210 > bundle2-exp=True
211 211 > evolution=createmarkers
212 212 > [ui]
213 > ssh=python "$TESTDIR/dummyssh"
213 > ssh=dummyssh
214 214 > logtemplate={rev}:{node|short} {phase} {author} {bookmarks} {desc|firstline}
215 215 > [web]
216 216 > push_ssl = false
217 217 > allow_push = *
218 218 > [phases]
219 219 > publish=False
220 220 > EOF
221 221
222 222 The extension requires a repo (currently unused)
223 223
224 224 $ hg init main
225 225 $ cd main
226 226 $ touch a
227 227 $ hg add a
228 228 $ hg commit -m 'a'
229 229
230 230
231 231 Empty bundle
232 232 =================
233 233
234 234 - no option
235 235 - no parts
236 236
237 237 Test bundling
238 238
239 239 $ hg bundle2
240 240 HG20\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc)
241 241
242 242 Test unbundling
243 243
244 244 $ hg bundle2 | hg statbundle2
245 245 options count: 0
246 246 parts count: 0
247 247
248 248 Test old style bundle are detected and refused
249 249
250 250 $ hg bundle --all ../bundle.hg
251 251 1 changesets found
252 252 $ hg statbundle2 < ../bundle.hg
253 253 abort: unknown bundle version 10
254 254 [255]
255 255
256 256 Test parameters
257 257 =================
258 258
259 259 - some options
260 260 - no parts
261 261
262 262 advisory parameters, no value
263 263 -------------------------------
264 264
265 265 Simplest possible parameters form
266 266
267 267 Test generation simple option
268 268
269 269 $ hg bundle2 --param 'caution'
270 270 HG20\x00\x00\x00\x07caution\x00\x00\x00\x00 (no-eol) (esc)
271 271
272 272 Test unbundling
273 273
274 274 $ hg bundle2 --param 'caution' | hg statbundle2
275 275 options count: 1
276 276 - caution
277 277 parts count: 0
278 278
279 279 Test generation multiple option
280 280
281 281 $ hg bundle2 --param 'caution' --param 'meal'
282 282 HG20\x00\x00\x00\x0ccaution meal\x00\x00\x00\x00 (no-eol) (esc)
283 283
284 284 Test unbundling
285 285
286 286 $ hg bundle2 --param 'caution' --param 'meal' | hg statbundle2
287 287 options count: 2
288 288 - caution
289 289 - meal
290 290 parts count: 0
291 291
292 292 advisory parameters, with value
293 293 -------------------------------
294 294
295 295 Test generation
296 296
297 297 $ hg bundle2 --param 'caution' --param 'meal=vegan' --param 'elephants'
298 298 HG20\x00\x00\x00\x1ccaution meal=vegan elephants\x00\x00\x00\x00 (no-eol) (esc)
299 299
300 300 Test unbundling
301 301
302 302 $ hg bundle2 --param 'caution' --param 'meal=vegan' --param 'elephants' | hg statbundle2
303 303 options count: 3
304 304 - caution
305 305 - elephants
306 306 - meal
307 307 vegan
308 308 parts count: 0
309 309
310 310 parameter with special char in value
311 311 ---------------------------------------------------
312 312
313 313 Test generation
314 314
315 315 $ hg bundle2 --param 'e|! 7/=babar%#==tutu' --param simple
316 316 HG20\x00\x00\x00)e%7C%21%207/=babar%25%23%3D%3Dtutu simple\x00\x00\x00\x00 (no-eol) (esc)
317 317
318 318 Test unbundling
319 319
320 320 $ hg bundle2 --param 'e|! 7/=babar%#==tutu' --param simple | hg statbundle2
321 321 options count: 2
322 322 - e|! 7/
323 323 babar%#==tutu
324 324 - simple
325 325 parts count: 0
326 326
327 327 Test unknown mandatory option
328 328 ---------------------------------------------------
329 329
330 330 $ hg bundle2 --param 'Gravity' | hg statbundle2
331 331 abort: unknown parameters: Stream Parameter - Gravity
332 332 [255]
333 333
334 334 Test debug output
335 335 ---------------------------------------------------
336 336
337 337 bundling debug
338 338
339 339 $ hg bundle2 --debug --param 'e|! 7/=babar%#==tutu' --param simple ../out.hg2 --config progress.debug=true --config devel.bundle2.debug=true
340 340 bundle2-output-bundle: "HG20", (2 params) 0 parts total
341 341 bundle2-output: start emission of HG20 stream
342 342 bundle2-output: bundle parameter: e%7C%21%207/=babar%25%23%3D%3Dtutu simple
343 343 bundle2-output: start of parts
344 344 bundle2-output: end of bundle
345 345
346 346 file content is ok
347 347
348 348 $ cat ../out.hg2
349 349 HG20\x00\x00\x00)e%7C%21%207/=babar%25%23%3D%3Dtutu simple\x00\x00\x00\x00 (no-eol) (esc)
350 350
351 351 unbundling debug
352 352
353 353 $ hg statbundle2 --debug --config progress.debug=true --config devel.bundle2.debug=true < ../out.hg2
354 354 bundle2-input: start processing of HG20 stream
355 355 bundle2-input: reading bundle2 stream parameters
356 356 bundle2-input: ignoring unknown parameter 'e|! 7/'
357 357 bundle2-input: ignoring unknown parameter 'simple'
358 358 options count: 2
359 359 - e|! 7/
360 360 babar%#==tutu
361 361 - simple
362 362 bundle2-input: start extraction of bundle2 parts
363 363 bundle2-input: part header size: 0
364 364 bundle2-input: end of bundle2 stream
365 365 parts count: 0
366 366
367 367
368 368 Test buggy input
369 369 ---------------------------------------------------
370 370
371 371 empty parameter name
372 372
373 373 $ hg bundle2 --param '' --quiet
374 374 abort: empty parameter name
375 375 [255]
376 376
377 377 bad parameter name
378 378
379 379 $ hg bundle2 --param 42babar
380 380 abort: non letter first character: '42babar'
381 381 [255]
382 382
383 383
384 384 Test part
385 385 =================
386 386
387 387 $ hg bundle2 --parts ../parts.hg2 --debug --config progress.debug=true --config devel.bundle2.debug=true
388 388 bundle2-output-bundle: "HG20", 7 parts total
389 389 bundle2-output: start emission of HG20 stream
390 390 bundle2-output: bundle parameter:
391 391 bundle2-output: start of parts
392 392 bundle2-output: bundle part: "test:empty"
393 393 bundle2-output-part: "test:empty" (advisory) empty payload
394 394 bundle2-output: part 0: "test:empty"
395 395 bundle2-output: header chunk size: 17
396 396 bundle2-output: closing payload chunk
397 397 bundle2-output: bundle part: "test:empty"
398 398 bundle2-output-part: "test:empty" (advisory) empty payload
399 399 bundle2-output: part 1: "test:empty"
400 400 bundle2-output: header chunk size: 17
401 401 bundle2-output: closing payload chunk
402 402 bundle2-output: bundle part: "test:song"
403 403 bundle2-output-part: "test:song" (advisory) 178 bytes payload
404 404 bundle2-output: part 2: "test:song"
405 405 bundle2-output: header chunk size: 16
406 406 bundle2-output: payload chunk size: 178
407 407 bundle2-output: closing payload chunk
408 408 bundle2-output: bundle part: "test:debugreply"
409 409 bundle2-output-part: "test:debugreply" (advisory) empty payload
410 410 bundle2-output: part 3: "test:debugreply"
411 411 bundle2-output: header chunk size: 22
412 412 bundle2-output: closing payload chunk
413 413 bundle2-output: bundle part: "test:math"
414 414 bundle2-output-part: "test:math" (advisory) (params: 2 mandatory 2 advisory) 2 bytes payload
415 415 bundle2-output: part 4: "test:math"
416 416 bundle2-output: header chunk size: 43
417 417 bundle2-output: payload chunk size: 2
418 418 bundle2-output: closing payload chunk
419 419 bundle2-output: bundle part: "test:song"
420 420 bundle2-output-part: "test:song" (advisory) (params: 1 mandatory) empty payload
421 421 bundle2-output: part 5: "test:song"
422 422 bundle2-output: header chunk size: 29
423 423 bundle2-output: closing payload chunk
424 424 bundle2-output: bundle part: "test:ping"
425 425 bundle2-output-part: "test:ping" (advisory) empty payload
426 426 bundle2-output: part 6: "test:ping"
427 427 bundle2-output: header chunk size: 16
428 428 bundle2-output: closing payload chunk
429 429 bundle2-output: end of bundle
430 430
431 431 $ cat ../parts.hg2
432 432 HG20\x00\x00\x00\x00\x00\x00\x00\x11 (esc)
433 433 test:empty\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11 (esc)
434 434 test:empty\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10 test:song\x00\x00\x00\x02\x00\x00\x00\x00\x00\xb2Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko (esc)
435 435 Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko
436 436 Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko.\x00\x00\x00\x00\x00\x00\x00\x16\x0ftest:debugreply\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00+ test:math\x00\x00\x00\x04\x02\x01\x02\x04\x01\x04\x07\x03pi3.14e2.72cookingraw\x00\x00\x00\x0242\x00\x00\x00\x00\x00\x00\x00\x1d test:song\x00\x00\x00\x05\x01\x00\x0b\x00randomparam\x00\x00\x00\x00\x00\x00\x00\x10 test:ping\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc)
437 437
438 438
439 439 $ hg statbundle2 < ../parts.hg2
440 440 options count: 0
441 441 :test:empty:
442 442 mandatory: 0
443 443 advisory: 0
444 444 payload: 0 bytes
445 445 :test:empty:
446 446 mandatory: 0
447 447 advisory: 0
448 448 payload: 0 bytes
449 449 :test:song:
450 450 mandatory: 0
451 451 advisory: 0
452 452 payload: 178 bytes
453 453 :test:debugreply:
454 454 mandatory: 0
455 455 advisory: 0
456 456 payload: 0 bytes
457 457 :test:math:
458 458 mandatory: 2
459 459 advisory: 1
460 460 payload: 2 bytes
461 461 :test:song:
462 462 mandatory: 1
463 463 advisory: 0
464 464 payload: 0 bytes
465 465 :test:ping:
466 466 mandatory: 0
467 467 advisory: 0
468 468 payload: 0 bytes
469 469 parts count: 7
470 470
471 471 $ hg statbundle2 --debug --config progress.debug=true --config devel.bundle2.debug=true < ../parts.hg2
472 472 bundle2-input: start processing of HG20 stream
473 473 bundle2-input: reading bundle2 stream parameters
474 474 options count: 0
475 475 bundle2-input: start extraction of bundle2 parts
476 476 bundle2-input: part header size: 17
477 477 bundle2-input: part type: "test:empty"
478 478 bundle2-input: part id: "0"
479 479 bundle2-input: part parameters: 0
480 480 :test:empty:
481 481 mandatory: 0
482 482 advisory: 0
483 483 bundle2-input: payload chunk size: 0
484 484 payload: 0 bytes
485 485 bundle2-input: part header size: 17
486 486 bundle2-input: part type: "test:empty"
487 487 bundle2-input: part id: "1"
488 488 bundle2-input: part parameters: 0
489 489 :test:empty:
490 490 mandatory: 0
491 491 advisory: 0
492 492 bundle2-input: payload chunk size: 0
493 493 payload: 0 bytes
494 494 bundle2-input: part header size: 16
495 495 bundle2-input: part type: "test:song"
496 496 bundle2-input: part id: "2"
497 497 bundle2-input: part parameters: 0
498 498 :test:song:
499 499 mandatory: 0
500 500 advisory: 0
501 501 bundle2-input: payload chunk size: 178
502 502 bundle2-input: payload chunk size: 0
503 503 bundle2-input-part: total payload size 178
504 504 payload: 178 bytes
505 505 bundle2-input: part header size: 22
506 506 bundle2-input: part type: "test:debugreply"
507 507 bundle2-input: part id: "3"
508 508 bundle2-input: part parameters: 0
509 509 :test:debugreply:
510 510 mandatory: 0
511 511 advisory: 0
512 512 bundle2-input: payload chunk size: 0
513 513 payload: 0 bytes
514 514 bundle2-input: part header size: 43
515 515 bundle2-input: part type: "test:math"
516 516 bundle2-input: part id: "4"
517 517 bundle2-input: part parameters: 3
518 518 :test:math:
519 519 mandatory: 2
520 520 advisory: 1
521 521 bundle2-input: payload chunk size: 2
522 522 bundle2-input: payload chunk size: 0
523 523 bundle2-input-part: total payload size 2
524 524 payload: 2 bytes
525 525 bundle2-input: part header size: 29
526 526 bundle2-input: part type: "test:song"
527 527 bundle2-input: part id: "5"
528 528 bundle2-input: part parameters: 1
529 529 :test:song:
530 530 mandatory: 1
531 531 advisory: 0
532 532 bundle2-input: payload chunk size: 0
533 533 payload: 0 bytes
534 534 bundle2-input: part header size: 16
535 535 bundle2-input: part type: "test:ping"
536 536 bundle2-input: part id: "6"
537 537 bundle2-input: part parameters: 0
538 538 :test:ping:
539 539 mandatory: 0
540 540 advisory: 0
541 541 bundle2-input: payload chunk size: 0
542 542 payload: 0 bytes
543 543 bundle2-input: part header size: 0
544 544 bundle2-input: end of bundle2 stream
545 545 parts count: 7
546 546
547 547 Test actual unbundling of test part
548 548 =======================================
549 549
550 550 Process the bundle
551 551
552 552 $ hg unbundle2 --debug --config progress.debug=true --config devel.bundle2.debug=true < ../parts.hg2
553 553 bundle2-input: start processing of HG20 stream
554 554 bundle2-input: reading bundle2 stream parameters
555 555 bundle2-input-bundle: with-transaction
556 556 bundle2-input: start extraction of bundle2 parts
557 557 bundle2-input: part header size: 17
558 558 bundle2-input: part type: "test:empty"
559 559 bundle2-input: part id: "0"
560 560 bundle2-input: part parameters: 0
561 561 bundle2-input: ignoring unsupported advisory part test:empty
562 562 bundle2-input-part: "test:empty" (advisory) unsupported-type
563 563 bundle2-input: payload chunk size: 0
564 564 bundle2-input: part header size: 17
565 565 bundle2-input: part type: "test:empty"
566 566 bundle2-input: part id: "1"
567 567 bundle2-input: part parameters: 0
568 568 bundle2-input: ignoring unsupported advisory part test:empty
569 569 bundle2-input-part: "test:empty" (advisory) unsupported-type
570 570 bundle2-input: payload chunk size: 0
571 571 bundle2-input: part header size: 16
572 572 bundle2-input: part type: "test:song"
573 573 bundle2-input: part id: "2"
574 574 bundle2-input: part parameters: 0
575 575 bundle2-input: found a handler for part 'test:song'
576 576 bundle2-input-part: "test:song" (advisory) supported
577 577 The choir starts singing:
578 578 bundle2-input: payload chunk size: 178
579 579 bundle2-input: payload chunk size: 0
580 580 bundle2-input-part: total payload size 178
581 581 Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko
582 582 Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko
583 583 Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko.
584 584 bundle2-input: part header size: 22
585 585 bundle2-input: part type: "test:debugreply"
586 586 bundle2-input: part id: "3"
587 587 bundle2-input: part parameters: 0
588 588 bundle2-input: found a handler for part 'test:debugreply'
589 589 bundle2-input-part: "test:debugreply" (advisory) supported
590 590 debugreply: no reply
591 591 bundle2-input: payload chunk size: 0
592 592 bundle2-input: part header size: 43
593 593 bundle2-input: part type: "test:math"
594 594 bundle2-input: part id: "4"
595 595 bundle2-input: part parameters: 3
596 596 bundle2-input: ignoring unsupported advisory part test:math
597 597 bundle2-input-part: "test:math" (advisory) (params: 2 mandatory 2 advisory) unsupported-type
598 598 bundle2-input: payload chunk size: 2
599 599 bundle2-input: payload chunk size: 0
600 600 bundle2-input-part: total payload size 2
601 601 bundle2-input: part header size: 29
602 602 bundle2-input: part type: "test:song"
603 603 bundle2-input: part id: "5"
604 604 bundle2-input: part parameters: 1
605 605 bundle2-input: found a handler for part 'test:song'
606 606 bundle2-input: ignoring unsupported advisory part test:song - randomparam
607 607 bundle2-input-part: "test:song" (advisory) (params: 1 mandatory) unsupported-params (['randomparam'])
608 608 bundle2-input: payload chunk size: 0
609 609 bundle2-input: part header size: 16
610 610 bundle2-input: part type: "test:ping"
611 611 bundle2-input: part id: "6"
612 612 bundle2-input: part parameters: 0
613 613 bundle2-input: found a handler for part 'test:ping'
614 614 bundle2-input-part: "test:ping" (advisory) supported
615 615 received ping request (id 6)
616 616 bundle2-input: payload chunk size: 0
617 617 bundle2-input: part header size: 0
618 618 bundle2-input: end of bundle2 stream
619 619 bundle2-input-bundle: 6 parts total
620 620 0 unread bytes
621 621 3 total verses sung
622 622
623 623 Unbundle with an unknown mandatory part
624 624 (should abort)
625 625
626 626 $ hg bundle2 --parts --unknown ../unknown.hg2
627 627
628 628 $ hg unbundle2 < ../unknown.hg2
629 629 The choir starts singing:
630 630 Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko
631 631 Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko
632 632 Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko.
633 633 debugreply: no reply
634 634 0 unread bytes
635 635 abort: missing support for test:unknown
636 636 [255]
637 637
638 638 Unbundle with an unknown mandatory part parameters
639 639 (should abort)
640 640
641 641 $ hg bundle2 --unknownparams ../unknown.hg2
642 642
643 643 $ hg unbundle2 < ../unknown.hg2
644 644 0 unread bytes
645 645 abort: missing support for test:song - randomparams
646 646 [255]
647 647
648 648 unbundle with a reply
649 649
650 650 $ hg bundle2 --parts --reply ../parts-reply.hg2
651 651 $ hg unbundle2 ../reply.hg2 < ../parts-reply.hg2
652 652 0 unread bytes
653 653 3 total verses sung
654 654
655 655 The reply is a bundle
656 656
657 657 $ cat ../reply.hg2
658 658 HG20\x00\x00\x00\x00\x00\x00\x00\x1b\x06output\x00\x00\x00\x00\x00\x01\x0b\x01in-reply-to3\x00\x00\x00\xd9The choir starts singing: (esc)
659 659 Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko
660 660 Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko
661 661 Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko.
662 662 \x00\x00\x00\x00\x00\x00\x00\x1b\x06output\x00\x00\x00\x01\x00\x01\x0b\x01in-reply-to4\x00\x00\x00\xc9debugreply: capabilities: (esc)
663 663 debugreply: 'city=!'
664 664 debugreply: 'celeste,ville'
665 665 debugreply: 'elephants'
666 666 debugreply: 'babar'
667 667 debugreply: 'celeste'
668 668 debugreply: 'ping-pong'
669 669 \x00\x00\x00\x00\x00\x00\x00\x1e test:pong\x00\x00\x00\x02\x01\x00\x0b\x01in-reply-to7\x00\x00\x00\x00\x00\x00\x00\x1b\x06output\x00\x00\x00\x03\x00\x01\x0b\x01in-reply-to7\x00\x00\x00=received ping request (id 7) (esc)
670 670 replying to ping request (id 7)
671 671 \x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc)
672 672
673 673 The reply is valid
674 674
675 675 $ hg statbundle2 < ../reply.hg2
676 676 options count: 0
677 677 :output:
678 678 mandatory: 0
679 679 advisory: 1
680 680 payload: 217 bytes
681 681 :output:
682 682 mandatory: 0
683 683 advisory: 1
684 684 payload: 201 bytes
685 685 :test:pong:
686 686 mandatory: 1
687 687 advisory: 0
688 688 payload: 0 bytes
689 689 :output:
690 690 mandatory: 0
691 691 advisory: 1
692 692 payload: 61 bytes
693 693 parts count: 4
694 694
695 695 Unbundle the reply to get the output:
696 696
697 697 $ hg unbundle2 < ../reply.hg2
698 698 remote: The choir starts singing:
699 699 remote: Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko
700 700 remote: Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko
701 701 remote: Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko.
702 702 remote: debugreply: capabilities:
703 703 remote: debugreply: 'city=!'
704 704 remote: debugreply: 'celeste,ville'
705 705 remote: debugreply: 'elephants'
706 706 remote: debugreply: 'babar'
707 707 remote: debugreply: 'celeste'
708 708 remote: debugreply: 'ping-pong'
709 709 remote: received ping request (id 7)
710 710 remote: replying to ping request (id 7)
711 711 0 unread bytes
712 712
713 713 Test push race detection
714 714
715 715 $ hg bundle2 --pushrace ../part-race.hg2
716 716
717 717 $ hg unbundle2 < ../part-race.hg2
718 718 0 unread bytes
719 719 abort: push race: repository changed while pushing - please try again
720 720 [255]
721 721
722 722 Support for changegroup
723 723 ===================================
724 724
725 725 $ hg unbundle $TESTDIR/bundles/rebase.hg
726 726 adding changesets
727 727 adding manifests
728 728 adding file changes
729 729 added 8 changesets with 7 changes to 7 files (+3 heads)
730 730 (run 'hg heads' to see heads, 'hg merge' to merge)
731 731
732 732 $ hg log -G
733 733 o 8:02de42196ebe draft Nicolas Dumazet <nicdumz.commits@gmail.com> H
734 734 |
735 735 | o 7:eea13746799a draft Nicolas Dumazet <nicdumz.commits@gmail.com> G
736 736 |/|
737 737 o | 6:24b6387c8c8c draft Nicolas Dumazet <nicdumz.commits@gmail.com> F
738 738 | |
739 739 | o 5:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E
740 740 |/
741 741 | o 4:32af7686d403 draft Nicolas Dumazet <nicdumz.commits@gmail.com> D
742 742 | |
743 743 | o 3:5fddd98957c8 draft Nicolas Dumazet <nicdumz.commits@gmail.com> C
744 744 | |
745 745 | o 2:42ccdea3bb16 draft Nicolas Dumazet <nicdumz.commits@gmail.com> B
746 746 |/
747 747 o 1:cd010b8cd998 draft Nicolas Dumazet <nicdumz.commits@gmail.com> A
748 748
749 749 @ 0:3903775176ed draft test a
750 750
751 751
752 752 $ hg bundle2 --debug --config progress.debug=true --config devel.bundle2.debug=true --rev '8+7+5+4' ../rev.hg2
753 753 4 changesets found
754 754 list of changesets:
755 755 32af7686d403cf45b5d95f2d70cebea587ac806a
756 756 9520eea781bcca16c1e15acc0ba14335a0e8e5ba
757 757 eea13746799a9e0bfd88f29d3c2e9dc9389f524f
758 758 02de42196ebee42ef284b6780a87cdc96e8eaab6
759 759 bundle2-output-bundle: "HG20", 1 parts total
760 760 bundle2-output: start emission of HG20 stream
761 761 bundle2-output: bundle parameter:
762 762 bundle2-output: start of parts
763 763 bundle2-output: bundle part: "changegroup"
764 764 bundle2-output-part: "changegroup" (advisory) streamed payload
765 765 bundle2-output: part 0: "changegroup"
766 766 bundle2-output: header chunk size: 18
767 767 bundling: 1/4 changesets (25.00%)
768 768 bundling: 2/4 changesets (50.00%)
769 769 bundling: 3/4 changesets (75.00%)
770 770 bundling: 4/4 changesets (100.00%)
771 771 bundling: 1/4 manifests (25.00%)
772 772 bundling: 2/4 manifests (50.00%)
773 773 bundling: 3/4 manifests (75.00%)
774 774 bundling: 4/4 manifests (100.00%)
775 775 bundling: D 1/3 files (33.33%)
776 776 bundling: E 2/3 files (66.67%)
777 777 bundling: H 3/3 files (100.00%)
778 778 bundle2-output: payload chunk size: 1555
779 779 bundle2-output: closing payload chunk
780 780 bundle2-output: end of bundle
781 781
782 782 $ cat ../rev.hg2
783 783 HG20\x00\x00\x00\x00\x00\x00\x00\x12\x0bchangegroup\x00\x00\x00\x00\x00\x00\x00\x00\x06\x13\x00\x00\x00\xa42\xafv\x86\xd4\x03\xcfE\xb5\xd9_-p\xce\xbe\xa5\x87\xac\x80j_\xdd\xd9\x89W\xc8\xa5JMCm\xfe\x1d\xa9\xd8\x7f!\xa1\xb9{\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x002\xafv\x86\xd4\x03\xcfE\xb5\xd9_-p\xce\xbe\xa5\x87\xac\x80j\x00\x00\x00\x00\x00\x00\x00)\x00\x00\x00)6e1f4c47ecb533ffd0c8e52cdc88afb6cd39e20c (esc)
784 784 \x00\x00\x00f\x00\x00\x00h\x00\x00\x00\x02D (esc)
785 785 \x00\x00\x00i\x00\x00\x00j\x00\x00\x00\x01D\x00\x00\x00\xa4\x95 \xee\xa7\x81\xbc\xca\x16\xc1\xe1Z\xcc\x0b\xa1C5\xa0\xe8\xe5\xba\xcd\x01\x0b\x8c\xd9\x98\xf3\x98\x1aZ\x81\x15\xf9O\x8d\xa4\xabP`\x89\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x95 \xee\xa7\x81\xbc\xca\x16\xc1\xe1Z\xcc\x0b\xa1C5\xa0\xe8\xe5\xba\x00\x00\x00\x00\x00\x00\x00)\x00\x00\x00)4dece9c826f69490507b98c6383a3009b295837d (esc)
786 786 \x00\x00\x00f\x00\x00\x00h\x00\x00\x00\x02E (esc)
787 787 \x00\x00\x00i\x00\x00\x00j\x00\x00\x00\x01E\x00\x00\x00\xa2\xee\xa17Fy\x9a\x9e\x0b\xfd\x88\xf2\x9d<.\x9d\xc98\x9fRO$\xb68|\x8c\x8c\xae7\x17\x88\x80\xf3\xfa\x95\xde\xd3\xcb\x1c\xf7\x85\x95 \xee\xa7\x81\xbc\xca\x16\xc1\xe1Z\xcc\x0b\xa1C5\xa0\xe8\xe5\xba\xee\xa17Fy\x9a\x9e\x0b\xfd\x88\xf2\x9d<.\x9d\xc98\x9fRO\x00\x00\x00\x00\x00\x00\x00)\x00\x00\x00)365b93d57fdf4814e2b5911d6bacff2b12014441 (esc)
788 788 \x00\x00\x00f\x00\x00\x00h\x00\x00\x00\x00\x00\x00\x00i\x00\x00\x00j\x00\x00\x00\x01G\x00\x00\x00\xa4\x02\xdeB\x19n\xbe\xe4.\xf2\x84\xb6x (esc)
789 789 \x87\xcd\xc9n\x8e\xaa\xb6$\xb68|\x8c\x8c\xae7\x17\x88\x80\xf3\xfa\x95\xde\xd3\xcb\x1c\xf7\x85\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xdeB\x19n\xbe\xe4.\xf2\x84\xb6x (esc)
790 790 \x87\xcd\xc9n\x8e\xaa\xb6\x00\x00\x00\x00\x00\x00\x00)\x00\x00\x00)8bee48edc7318541fc0013ee41b089276a8c24bf (esc)
791 791 \x00\x00\x00f\x00\x00\x00f\x00\x00\x00\x02H (esc)
792 792 \x00\x00\x00g\x00\x00\x00h\x00\x00\x00\x01H\x00\x00\x00\x00\x00\x00\x00\x8bn\x1fLG\xec\xb53\xff\xd0\xc8\xe5,\xdc\x88\xaf\xb6\xcd9\xe2\x0cf\xa5\xa0\x18\x17\xfd\xf5#\x9c'8\x02\xb5\xb7a\x8d\x05\x1c\x89\xe4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x002\xafv\x86\xd4\x03\xcfE\xb5\xd9_-p\xce\xbe\xa5\x87\xac\x80j\x00\x00\x00\x81\x00\x00\x00\x81\x00\x00\x00+D\x00c3f1ca2924c16a19b0656a84900e504e5b0aec2d (esc)
793 793 \x00\x00\x00\x8bM\xec\xe9\xc8&\xf6\x94\x90P{\x98\xc68:0 \xb2\x95\x83}\x00}\x8c\x9d\x88\x84\x13%\xf5\xc6\xb0cq\xb3[N\x8a+\x1a\x83\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x95 \xee\xa7\x81\xbc\xca\x16\xc1\xe1Z\xcc\x0b\xa1C5\xa0\xe8\xe5\xba\x00\x00\x00+\x00\x00\x00\xac\x00\x00\x00+E\x009c6fd0350a6c0d0c49d4a9c5017cf07043f54e58 (esc)
794 794 \x00\x00\x00\x8b6[\x93\xd5\x7f\xdfH\x14\xe2\xb5\x91\x1dk\xac\xff+\x12\x01DA(\xa5\x84\xc6^\xf1!\xf8\x9e\xb6j\xb7\xd0\xbc\x15=\x80\x99\xe7\xceM\xec\xe9\xc8&\xf6\x94\x90P{\x98\xc68:0 \xb2\x95\x83}\xee\xa17Fy\x9a\x9e\x0b\xfd\x88\xf2\x9d<.\x9d\xc98\x9fRO\x00\x00\x00V\x00\x00\x00V\x00\x00\x00+F\x0022bfcfd62a21a3287edbd4d656218d0f525ed76a (esc)
795 795 \x00\x00\x00\x97\x8b\xeeH\xed\xc71\x85A\xfc\x00\x13\xeeA\xb0\x89'j\x8c$\xbf(\xa5\x84\xc6^\xf1!\xf8\x9e\xb6j\xb7\xd0\xbc\x15=\x80\x99\xe7\xce\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xdeB\x19n\xbe\xe4.\xf2\x84\xb6x (esc)
796 796 \x87\xcd\xc9n\x8e\xaa\xb6\x00\x00\x00+\x00\x00\x00V\x00\x00\x00\x00\x00\x00\x00\x81\x00\x00\x00\x81\x00\x00\x00+H\x008500189e74a9e0475e822093bc7db0d631aeb0b4 (esc)
797 797 \x00\x00\x00\x00\x00\x00\x00\x05D\x00\x00\x00b\xc3\xf1\xca)$\xc1j\x19\xb0ej\x84\x90\x0ePN[ (esc)
798 798 \xec-\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x002\xafv\x86\xd4\x03\xcfE\xb5\xd9_-p\xce\xbe\xa5\x87\xac\x80j\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02D (esc)
799 799 \x00\x00\x00\x00\x00\x00\x00\x05E\x00\x00\x00b\x9co\xd05 (esc)
800 800 l\r (no-eol) (esc)
801 801 \x0cI\xd4\xa9\xc5\x01|\xf0pC\xf5NX\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x95 \xee\xa7\x81\xbc\xca\x16\xc1\xe1Z\xcc\x0b\xa1C5\xa0\xe8\xe5\xba\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02E (esc)
802 802 \x00\x00\x00\x00\x00\x00\x00\x05H\x00\x00\x00b\x85\x00\x18\x9et\xa9\xe0G^\x82 \x93\xbc}\xb0\xd61\xae\xb0\xb4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xdeB\x19n\xbe\xe4.\xf2\x84\xb6x (esc)
803 803 \x87\xcd\xc9n\x8e\xaa\xb6\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02H (esc)
804 804 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc)
805 805
806 806 $ hg debugbundle ../rev.hg2
807 807 Stream params: {}
808 808 changegroup -- '{}'
809 809 32af7686d403cf45b5d95f2d70cebea587ac806a
810 810 9520eea781bcca16c1e15acc0ba14335a0e8e5ba
811 811 eea13746799a9e0bfd88f29d3c2e9dc9389f524f
812 812 02de42196ebee42ef284b6780a87cdc96e8eaab6
813 813 $ hg unbundle ../rev.hg2
814 814 adding changesets
815 815 adding manifests
816 816 adding file changes
817 817 added 0 changesets with 0 changes to 3 files
818 818
819 819 with reply
820 820
821 821 $ hg bundle2 --rev '8+7+5+4' --reply ../rev-rr.hg2
822 822 $ hg unbundle2 ../rev-reply.hg2 < ../rev-rr.hg2
823 823 0 unread bytes
824 824 addchangegroup return: 1
825 825
826 826 $ cat ../rev-reply.hg2
827 827 HG20\x00\x00\x00\x00\x00\x00\x00/\x11reply:changegroup\x00\x00\x00\x00\x00\x02\x0b\x01\x06\x01in-reply-to1return1\x00\x00\x00\x00\x00\x00\x00\x1b\x06output\x00\x00\x00\x01\x00\x01\x0b\x01in-reply-to1\x00\x00\x00dadding changesets (esc)
828 828 adding manifests
829 829 adding file changes
830 830 added 0 changesets with 0 changes to 3 files
831 831 \x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc)
832 832
833 833 Check handling of exception during generation.
834 834 ----------------------------------------------
835 835
836 836 $ hg bundle2 --genraise > ../genfailed.hg2
837 837 abort: Someone set up us the bomb!
838 838 [255]
839 839
840 840 Should still be a valid bundle
841 841
842 842 $ cat ../genfailed.hg2
843 843 HG20\x00\x00\x00\x00\x00\x00\x00\r (no-eol) (esc)
844 844 \x06output\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00H\x0berror:abort\x00\x00\x00\x00\x01\x00\x07-messageunexpected error: Someone set up us the bomb!\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc)
845 845
846 846 And its handling on the other size raise a clean exception
847 847
848 848 $ cat ../genfailed.hg2 | hg unbundle2
849 849 0 unread bytes
850 850 abort: unexpected error: Someone set up us the bomb!
851 851 [255]
852 852
853 853
854 854 $ cd ..
@@ -1,111 +1,111 b''
1 1 $ cat > bundle2.py << EOF
2 2 > """A small extension to test bundle2 pushback parts.
3 3 > Current bundle2 implementation doesn't provide a way to generate those
4 4 > parts, so they must be created by extensions.
5 5 > """
6 6 > from mercurial import bundle2, pushkey, exchange, util
7 7 > def _newhandlechangegroup(op, inpart):
8 8 > """This function wraps the changegroup part handler for getbundle.
9 9 > It issues an additional pushkey part to send a new
10 10 > bookmark back to the client"""
11 11 > result = bundle2.handlechangegroup(op, inpart)
12 12 > if 'pushback' in op.reply.capabilities:
13 13 > params = {'namespace': 'bookmarks',
14 14 > 'key': 'new-server-mark',
15 15 > 'old': '',
16 16 > 'new': 'tip'}
17 17 > encodedparams = [(k, pushkey.encode(v)) for (k,v) in params.items()]
18 18 > op.reply.newpart('pushkey', mandatoryparams=encodedparams)
19 19 > else:
20 20 > op.reply.newpart('output', data='pushback not enabled')
21 21 > return result
22 22 > _newhandlechangegroup.params = bundle2.handlechangegroup.params
23 23 > bundle2.parthandlermapping['changegroup'] = _newhandlechangegroup
24 24 > EOF
25 25
26 26 $ cat >> $HGRCPATH <<EOF
27 27 > [ui]
28 > ssh = python "$TESTDIR/dummyssh"
28 > ssh = dummyssh
29 29 > username = nobody <no.reply@example.com>
30 30 >
31 31 > [alias]
32 32 > tglog = log -G -T "{desc} [{phase}:{node|short}]"
33 33 > EOF
34 34
35 35 Set up server repository
36 36
37 37 $ hg init server
38 38 $ cd server
39 39 $ echo c0 > f0
40 40 $ hg commit -Am 0
41 41 adding f0
42 42
43 43 Set up client repository
44 44
45 45 $ cd ..
46 46 $ hg clone ssh://user@dummy/server client -q
47 47 $ cd client
48 48
49 49 Enable extension
50 50 $ cat >> $HGRCPATH <<EOF
51 51 > [extensions]
52 52 > bundle2=$TESTTMP/bundle2.py
53 53 > [experimental]
54 54 > bundle2-exp = True
55 55 > EOF
56 56
57 57 Without config
58 58
59 59 $ cd ../client
60 60 $ echo c1 > f1
61 61 $ hg commit -Am 1
62 62 adding f1
63 63 $ hg push
64 64 pushing to ssh://user@dummy/server
65 65 searching for changes
66 66 remote: adding changesets
67 67 remote: adding manifests
68 68 remote: adding file changes
69 69 remote: added 1 changesets with 1 changes to 1 files
70 70 remote: pushback not enabled
71 71 $ hg bookmark
72 72 no bookmarks set
73 73
74 74 $ cd ../server
75 75 $ hg tglog
76 76 o 1 [public:2b9c7234e035]
77 77 |
78 78 @ 0 [public:6cee5c8f3e5b]
79 79
80 80
81 81
82 82
83 83 With config
84 84
85 85 $ cd ../client
86 86 $ echo '[experimental]' >> .hg/hgrc
87 87 $ echo 'bundle2.pushback = True' >> .hg/hgrc
88 88 $ echo c2 > f2
89 89 $ hg commit -Am 2
90 90 adding f2
91 91 $ hg push
92 92 pushing to ssh://user@dummy/server
93 93 searching for changes
94 94 remote: adding changesets
95 95 remote: adding manifests
96 96 remote: adding file changes
97 97 remote: added 1 changesets with 1 changes to 1 files
98 98 $ hg bookmark
99 99 new-server-mark 2:0a76dfb2e179
100 100
101 101 $ cd ../server
102 102 $ hg tglog
103 103 o 2 [public:0a76dfb2e179]
104 104 |
105 105 o 1 [public:2b9c7234e035]
106 106 |
107 107 @ 0 [public:6cee5c8f3e5b]
108 108
109 109
110 110
111 111
@@ -1,592 +1,592 b''
1 1 #require killdaemons
2 2
3 3 Create an extension to test bundle2 remote-changegroup parts
4 4
5 5 $ cat > bundle2.py << EOF
6 6 > """A small extension to test bundle2 remote-changegroup parts.
7 7 >
8 8 > Current bundle2 implementation doesn't provide a way to generate those
9 9 > parts, so they must be created by extensions.
10 10 > """
11 11 > from mercurial import bundle2, changegroup, exchange, util
12 12 >
13 13 > def _getbundlechangegrouppart(bundler, repo, source, bundlecaps=None,
14 14 > b2caps=None, heads=None, common=None,
15 15 > **kwargs):
16 16 > """this function replaces the changegroup part handler for getbundle.
17 17 > It allows to create a set of arbitrary parts containing changegroups
18 18 > and remote-changegroups, as described in a bundle2maker file in the
19 19 > repository .hg/ directory.
20 20 >
21 21 > Each line of that bundle2maker file contain a description of the
22 22 > part to add:
23 23 > - changegroup common_revset heads_revset
24 24 > Creates a changegroup part based, using common_revset and
25 25 > heads_revset for changegroup.getchangegroup.
26 26 > - remote-changegroup url file
27 27 > Creates a remote-changegroup part for a bundle at the given
28 28 > url. Size and digest, as required by the client, are computed
29 29 > from the given file.
30 30 > - raw-remote-changegroup <python expression>
31 31 > Creates a remote-changegroup part with the data given in the
32 32 > python expression as parameters. The python expression is
33 33 > evaluated with eval, and is expected to be a dict.
34 34 > """
35 35 > def newpart(name, data=''):
36 36 > """wrapper around bundler.newpart adding an extra part making the
37 37 > client output information about each processed part"""
38 38 > bundler.newpart('output', data=name)
39 39 > part = bundler.newpart(name, data=data)
40 40 > return part
41 41 >
42 42 > for line in open(repo.join('bundle2maker'), 'r'):
43 43 > line = line.strip()
44 44 > try:
45 45 > verb, args = line.split(None, 1)
46 46 > except ValueError:
47 47 > verb, args = line, ''
48 48 > if verb == 'remote-changegroup':
49 49 > url, file = args.split()
50 50 > bundledata = open(file, 'rb').read()
51 51 > digest = util.digester.preferred(b2caps['digests'])
52 52 > d = util.digester([digest], bundledata)
53 53 > part = newpart('remote-changegroup')
54 54 > part.addparam('url', url)
55 55 > part.addparam('size', str(len(bundledata)))
56 56 > part.addparam('digests', digest)
57 57 > part.addparam('digest:%s' % digest, d[digest])
58 58 > elif verb == 'raw-remote-changegroup':
59 59 > part = newpart('remote-changegroup')
60 60 > for k, v in eval(args).items():
61 61 > part.addparam(k, str(v))
62 62 > elif verb == 'changegroup':
63 63 > _common, heads = args.split()
64 64 > common.extend(repo.lookup(r) for r in repo.revs(_common))
65 65 > heads = [repo.lookup(r) for r in repo.revs(heads)]
66 66 > cg = changegroup.getchangegroup(repo, 'changegroup',
67 67 > heads=heads, common=common)
68 68 > newpart('changegroup', cg.getchunks())
69 69 > else:
70 70 > raise Exception('unknown verb')
71 71 >
72 72 > exchange.getbundle2partsmapping['changegroup'] = _getbundlechangegrouppart
73 73 > EOF
74 74
75 75 Start a simple HTTP server to serve bundles
76 76
77 77 $ python "$TESTDIR/dumbhttp.py" -p $HGPORT --pid dumb.pid
78 78 $ cat dumb.pid >> $DAEMON_PIDS
79 79
80 80 $ cat >> $HGRCPATH << EOF
81 81 > [experimental]
82 82 > bundle2-exp=True
83 83 > [ui]
84 > ssh=python "$TESTDIR/dummyssh"
84 > ssh=dummyssh
85 85 > logtemplate={rev}:{node|short} {phase} {author} {bookmarks} {desc|firstline}
86 86 > EOF
87 87
88 88 $ hg init repo
89 89
90 90 $ hg -R repo unbundle $TESTDIR/bundles/rebase.hg
91 91 adding changesets
92 92 adding manifests
93 93 adding file changes
94 94 added 8 changesets with 7 changes to 7 files (+2 heads)
95 95 (run 'hg heads' to see heads, 'hg merge' to merge)
96 96
97 97 $ hg -R repo log -G
98 98 o 7:02de42196ebe draft Nicolas Dumazet <nicdumz.commits@gmail.com> H
99 99 |
100 100 | o 6:eea13746799a draft Nicolas Dumazet <nicdumz.commits@gmail.com> G
101 101 |/|
102 102 o | 5:24b6387c8c8c draft Nicolas Dumazet <nicdumz.commits@gmail.com> F
103 103 | |
104 104 | o 4:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E
105 105 |/
106 106 | o 3:32af7686d403 draft Nicolas Dumazet <nicdumz.commits@gmail.com> D
107 107 | |
108 108 | o 2:5fddd98957c8 draft Nicolas Dumazet <nicdumz.commits@gmail.com> C
109 109 | |
110 110 | o 1:42ccdea3bb16 draft Nicolas Dumazet <nicdumz.commits@gmail.com> B
111 111 |/
112 112 o 0:cd010b8cd998 draft Nicolas Dumazet <nicdumz.commits@gmail.com> A
113 113
114 114 $ hg clone repo orig
115 115 updating to branch default
116 116 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
117 117
118 118 $ cat > repo/.hg/hgrc << EOF
119 119 > [extensions]
120 120 > bundle2=$TESTTMP/bundle2.py
121 121 > EOF
122 122
123 123 Test a pull with an remote-changegroup
124 124
125 125 $ hg bundle -R repo --base '0:4' -r '5:7' bundle.hg
126 126 3 changesets found
127 127 $ cat > repo/.hg/bundle2maker << EOF
128 128 > remote-changegroup http://localhost:$HGPORT/bundle.hg bundle.hg
129 129 > EOF
130 130 $ hg clone orig clone -r 3 -r 4
131 131 adding changesets
132 132 adding manifests
133 133 adding file changes
134 134 added 5 changesets with 5 changes to 5 files (+1 heads)
135 135 updating to branch default
136 136 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
137 137 $ hg pull -R clone ssh://user@dummy/repo
138 138 pulling from ssh://user@dummy/repo
139 139 searching for changes
140 140 remote: remote-changegroup
141 141 adding changesets
142 142 adding manifests
143 143 adding file changes
144 144 added 3 changesets with 2 changes to 2 files (+1 heads)
145 145 (run 'hg heads .' to see heads, 'hg merge' to merge)
146 146 $ hg -R clone log -G
147 147 o 7:02de42196ebe public Nicolas Dumazet <nicdumz.commits@gmail.com> H
148 148 |
149 149 | o 6:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> G
150 150 |/|
151 151 o | 5:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
152 152 | |
153 153 | o 4:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E
154 154 |/
155 155 | @ 3:32af7686d403 public Nicolas Dumazet <nicdumz.commits@gmail.com> D
156 156 | |
157 157 | o 2:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> C
158 158 | |
159 159 | o 1:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> B
160 160 |/
161 161 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
162 162
163 163 $ rm -rf clone
164 164
165 165 Test a pull with an remote-changegroup and a following changegroup
166 166
167 167 $ hg bundle -R repo --base 2 -r '3:4' bundle2.hg
168 168 2 changesets found
169 169 $ cat > repo/.hg/bundle2maker << EOF
170 170 > remote-changegroup http://localhost:$HGPORT/bundle2.hg bundle2.hg
171 171 > changegroup 0:4 5:7
172 172 > EOF
173 173 $ hg clone orig clone -r 2
174 174 adding changesets
175 175 adding manifests
176 176 adding file changes
177 177 added 3 changesets with 3 changes to 3 files
178 178 updating to branch default
179 179 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
180 180 $ hg pull -R clone ssh://user@dummy/repo
181 181 pulling from ssh://user@dummy/repo
182 182 searching for changes
183 183 remote: remote-changegroup
184 184 adding changesets
185 185 adding manifests
186 186 adding file changes
187 187 added 2 changesets with 2 changes to 2 files (+1 heads)
188 188 remote: changegroup
189 189 adding changesets
190 190 adding manifests
191 191 adding file changes
192 192 added 3 changesets with 2 changes to 2 files (+1 heads)
193 193 (run 'hg heads' to see heads, 'hg merge' to merge)
194 194 $ hg -R clone log -G
195 195 o 7:02de42196ebe public Nicolas Dumazet <nicdumz.commits@gmail.com> H
196 196 |
197 197 | o 6:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> G
198 198 |/|
199 199 o | 5:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
200 200 | |
201 201 | o 4:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E
202 202 |/
203 203 | o 3:32af7686d403 public Nicolas Dumazet <nicdumz.commits@gmail.com> D
204 204 | |
205 205 | @ 2:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> C
206 206 | |
207 207 | o 1:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> B
208 208 |/
209 209 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
210 210
211 211 $ rm -rf clone
212 212
213 213 Test a pull with a changegroup followed by an remote-changegroup
214 214
215 215 $ hg bundle -R repo --base '0:4' -r '5:7' bundle3.hg
216 216 3 changesets found
217 217 $ cat > repo/.hg/bundle2maker << EOF
218 218 > changegroup 000000000000 :4
219 219 > remote-changegroup http://localhost:$HGPORT/bundle3.hg bundle3.hg
220 220 > EOF
221 221 $ hg clone orig clone -r 2
222 222 adding changesets
223 223 adding manifests
224 224 adding file changes
225 225 added 3 changesets with 3 changes to 3 files
226 226 updating to branch default
227 227 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
228 228 $ hg pull -R clone ssh://user@dummy/repo
229 229 pulling from ssh://user@dummy/repo
230 230 searching for changes
231 231 remote: changegroup
232 232 adding changesets
233 233 adding manifests
234 234 adding file changes
235 235 added 2 changesets with 2 changes to 2 files (+1 heads)
236 236 remote: remote-changegroup
237 237 adding changesets
238 238 adding manifests
239 239 adding file changes
240 240 added 3 changesets with 2 changes to 2 files (+1 heads)
241 241 (run 'hg heads' to see heads, 'hg merge' to merge)
242 242 $ hg -R clone log -G
243 243 o 7:02de42196ebe public Nicolas Dumazet <nicdumz.commits@gmail.com> H
244 244 |
245 245 | o 6:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> G
246 246 |/|
247 247 o | 5:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
248 248 | |
249 249 | o 4:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E
250 250 |/
251 251 | o 3:32af7686d403 public Nicolas Dumazet <nicdumz.commits@gmail.com> D
252 252 | |
253 253 | @ 2:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> C
254 254 | |
255 255 | o 1:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> B
256 256 |/
257 257 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
258 258
259 259 $ rm -rf clone
260 260
261 261 Test a pull with two remote-changegroups and a changegroup
262 262
263 263 $ hg bundle -R repo --base 2 -r '3:4' bundle4.hg
264 264 2 changesets found
265 265 $ hg bundle -R repo --base '3:4' -r '5:6' bundle5.hg
266 266 2 changesets found
267 267 $ cat > repo/.hg/bundle2maker << EOF
268 268 > remote-changegroup http://localhost:$HGPORT/bundle4.hg bundle4.hg
269 269 > remote-changegroup http://localhost:$HGPORT/bundle5.hg bundle5.hg
270 270 > changegroup 0:6 7
271 271 > EOF
272 272 $ hg clone orig clone -r 2
273 273 adding changesets
274 274 adding manifests
275 275 adding file changes
276 276 added 3 changesets with 3 changes to 3 files
277 277 updating to branch default
278 278 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
279 279 $ hg pull -R clone ssh://user@dummy/repo
280 280 pulling from ssh://user@dummy/repo
281 281 searching for changes
282 282 remote: remote-changegroup
283 283 adding changesets
284 284 adding manifests
285 285 adding file changes
286 286 added 2 changesets with 2 changes to 2 files (+1 heads)
287 287 remote: remote-changegroup
288 288 adding changesets
289 289 adding manifests
290 290 adding file changes
291 291 added 2 changesets with 1 changes to 1 files
292 292 remote: changegroup
293 293 adding changesets
294 294 adding manifests
295 295 adding file changes
296 296 added 1 changesets with 1 changes to 1 files (+1 heads)
297 297 (run 'hg heads' to see heads, 'hg merge' to merge)
298 298 $ hg -R clone log -G
299 299 o 7:02de42196ebe public Nicolas Dumazet <nicdumz.commits@gmail.com> H
300 300 |
301 301 | o 6:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> G
302 302 |/|
303 303 o | 5:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
304 304 | |
305 305 | o 4:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E
306 306 |/
307 307 | o 3:32af7686d403 public Nicolas Dumazet <nicdumz.commits@gmail.com> D
308 308 | |
309 309 | @ 2:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> C
310 310 | |
311 311 | o 1:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> B
312 312 |/
313 313 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
314 314
315 315 $ rm -rf clone
316 316
317 317 Hash digest tests
318 318
319 319 $ hg bundle -R repo -a bundle6.hg
320 320 8 changesets found
321 321
322 322 $ cat > repo/.hg/bundle2maker << EOF
323 323 > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'sha1', 'digest:sha1': '2c880cfec23cff7d8f80c2f12958d1563cbdaba6'}
324 324 > EOF
325 325 $ hg clone ssh://user@dummy/repo clone
326 326 requesting all changes
327 327 remote: remote-changegroup
328 328 adding changesets
329 329 adding manifests
330 330 adding file changes
331 331 added 8 changesets with 7 changes to 7 files (+2 heads)
332 332 updating to branch default
333 333 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
334 334 $ rm -rf clone
335 335
336 336 $ cat > repo/.hg/bundle2maker << EOF
337 337 > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'md5', 'digest:md5': 'e22172c2907ef88794b7bea6642c2394'}
338 338 > EOF
339 339 $ hg clone ssh://user@dummy/repo clone
340 340 requesting all changes
341 341 remote: remote-changegroup
342 342 adding changesets
343 343 adding manifests
344 344 adding file changes
345 345 added 8 changesets with 7 changes to 7 files (+2 heads)
346 346 updating to branch default
347 347 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
348 348 $ rm -rf clone
349 349
350 350 Hash digest mismatch throws an error
351 351
352 352 $ cat > repo/.hg/bundle2maker << EOF
353 353 > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'sha1', 'digest:sha1': '0' * 40}
354 354 > EOF
355 355 $ hg clone ssh://user@dummy/repo clone
356 356 requesting all changes
357 357 remote: remote-changegroup
358 358 adding changesets
359 359 adding manifests
360 360 adding file changes
361 361 added 8 changesets with 7 changes to 7 files (+2 heads)
362 362 transaction abort!
363 363 rollback completed
364 364 abort: bundle at http://localhost:$HGPORT/bundle6.hg is corrupted:
365 365 sha1 mismatch: expected 0000000000000000000000000000000000000000, got 2c880cfec23cff7d8f80c2f12958d1563cbdaba6
366 366 [255]
367 367
368 368 Multiple hash digests can be given
369 369
370 370 $ cat > repo/.hg/bundle2maker << EOF
371 371 > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'md5 sha1', 'digest:md5': 'e22172c2907ef88794b7bea6642c2394', 'digest:sha1': '2c880cfec23cff7d8f80c2f12958d1563cbdaba6'}
372 372 > EOF
373 373 $ hg clone ssh://user@dummy/repo clone
374 374 requesting all changes
375 375 remote: remote-changegroup
376 376 adding changesets
377 377 adding manifests
378 378 adding file changes
379 379 added 8 changesets with 7 changes to 7 files (+2 heads)
380 380 updating to branch default
381 381 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
382 382 $ rm -rf clone
383 383
384 384 If either of the multiple hash digests mismatches, an error is thrown
385 385
386 386 $ cat > repo/.hg/bundle2maker << EOF
387 387 > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'md5 sha1', 'digest:md5': '0' * 32, 'digest:sha1': '2c880cfec23cff7d8f80c2f12958d1563cbdaba6'}
388 388 > EOF
389 389 $ hg clone ssh://user@dummy/repo clone
390 390 requesting all changes
391 391 remote: remote-changegroup
392 392 adding changesets
393 393 adding manifests
394 394 adding file changes
395 395 added 8 changesets with 7 changes to 7 files (+2 heads)
396 396 transaction abort!
397 397 rollback completed
398 398 abort: bundle at http://localhost:$HGPORT/bundle6.hg is corrupted:
399 399 md5 mismatch: expected 00000000000000000000000000000000, got e22172c2907ef88794b7bea6642c2394
400 400 [255]
401 401
402 402 $ cat > repo/.hg/bundle2maker << EOF
403 403 > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'md5 sha1', 'digest:md5': 'e22172c2907ef88794b7bea6642c2394', 'digest:sha1': '0' * 40}
404 404 > EOF
405 405 $ hg clone ssh://user@dummy/repo clone
406 406 requesting all changes
407 407 remote: remote-changegroup
408 408 adding changesets
409 409 adding manifests
410 410 adding file changes
411 411 added 8 changesets with 7 changes to 7 files (+2 heads)
412 412 transaction abort!
413 413 rollback completed
414 414 abort: bundle at http://localhost:$HGPORT/bundle6.hg is corrupted:
415 415 sha1 mismatch: expected 0000000000000000000000000000000000000000, got 2c880cfec23cff7d8f80c2f12958d1563cbdaba6
416 416 [255]
417 417
418 418 Corruption tests
419 419
420 420 $ hg clone orig clone -r 2
421 421 adding changesets
422 422 adding manifests
423 423 adding file changes
424 424 added 3 changesets with 3 changes to 3 files
425 425 updating to branch default
426 426 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
427 427
428 428 $ cat > repo/.hg/bundle2maker << EOF
429 429 > remote-changegroup http://localhost:$HGPORT/bundle4.hg bundle4.hg
430 430 > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle5.hg', 'size': 578, 'digests': 'sha1', 'digest:sha1': '0' * 40}
431 431 > changegroup 0:6 7
432 432 > EOF
433 433 $ hg pull -R clone ssh://user@dummy/repo
434 434 pulling from ssh://user@dummy/repo
435 435 searching for changes
436 436 remote: remote-changegroup
437 437 adding changesets
438 438 adding manifests
439 439 adding file changes
440 440 added 2 changesets with 2 changes to 2 files (+1 heads)
441 441 remote: remote-changegroup
442 442 adding changesets
443 443 adding manifests
444 444 adding file changes
445 445 added 2 changesets with 1 changes to 1 files
446 446 transaction abort!
447 447 rollback completed
448 448 abort: bundle at http://localhost:$HGPORT/bundle5.hg is corrupted:
449 449 sha1 mismatch: expected 0000000000000000000000000000000000000000, got f29485d6bfd37db99983cfc95ecb52f8ca396106
450 450 [255]
451 451
452 452 The entire transaction has been rolled back in the pull above
453 453
454 454 $ hg -R clone log -G
455 455 @ 2:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> C
456 456 |
457 457 o 1:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> B
458 458 |
459 459 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
460 460
461 461
462 462 No params
463 463
464 464 $ cat > repo/.hg/bundle2maker << EOF
465 465 > raw-remote-changegroup {}
466 466 > EOF
467 467 $ hg pull -R clone ssh://user@dummy/repo
468 468 pulling from ssh://user@dummy/repo
469 469 searching for changes
470 470 remote: remote-changegroup
471 471 abort: remote-changegroup: missing "url" param
472 472 [255]
473 473
474 474 Missing size
475 475
476 476 $ cat > repo/.hg/bundle2maker << EOF
477 477 > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle4.hg'}
478 478 > EOF
479 479 $ hg pull -R clone ssh://user@dummy/repo
480 480 pulling from ssh://user@dummy/repo
481 481 searching for changes
482 482 remote: remote-changegroup
483 483 abort: remote-changegroup: missing "size" param
484 484 [255]
485 485
486 486 Invalid size
487 487
488 488 $ cat > repo/.hg/bundle2maker << EOF
489 489 > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle4.hg', 'size': 'foo'}
490 490 > EOF
491 491 $ hg pull -R clone ssh://user@dummy/repo
492 492 pulling from ssh://user@dummy/repo
493 493 searching for changes
494 494 remote: remote-changegroup
495 495 abort: remote-changegroup: invalid value for param "size"
496 496 [255]
497 497
498 498 Size mismatch
499 499
500 500 $ cat > repo/.hg/bundle2maker << EOF
501 501 > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle4.hg', 'size': 42}
502 502 > EOF
503 503 $ hg pull -R clone ssh://user@dummy/repo
504 504 pulling from ssh://user@dummy/repo
505 505 searching for changes
506 506 remote: remote-changegroup
507 507 adding changesets
508 508 adding manifests
509 509 adding file changes
510 510 added 2 changesets with 2 changes to 2 files (+1 heads)
511 511 transaction abort!
512 512 rollback completed
513 513 abort: bundle at http://localhost:$HGPORT/bundle4.hg is corrupted:
514 514 size mismatch: expected 42, got 581
515 515 [255]
516 516
517 517 Unknown digest
518 518
519 519 $ cat > repo/.hg/bundle2maker << EOF
520 520 > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle4.hg', 'size': 581, 'digests': 'foo', 'digest:foo': 'bar'}
521 521 > EOF
522 522 $ hg pull -R clone ssh://user@dummy/repo
523 523 pulling from ssh://user@dummy/repo
524 524 searching for changes
525 525 remote: remote-changegroup
526 526 abort: missing support for remote-changegroup - digest:foo
527 527 [255]
528 528
529 529 Missing digest
530 530
531 531 $ cat > repo/.hg/bundle2maker << EOF
532 532 > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle4.hg', 'size': 581, 'digests': 'sha1'}
533 533 > EOF
534 534 $ hg pull -R clone ssh://user@dummy/repo
535 535 pulling from ssh://user@dummy/repo
536 536 searching for changes
537 537 remote: remote-changegroup
538 538 abort: remote-changegroup: missing "digest:sha1" param
539 539 [255]
540 540
541 541 Not an HTTP url
542 542
543 543 $ cat > repo/.hg/bundle2maker << EOF
544 544 > raw-remote-changegroup {'url': 'ssh://localhost:$HGPORT/bundle4.hg', 'size': 581}
545 545 > EOF
546 546 $ hg pull -R clone ssh://user@dummy/repo
547 547 pulling from ssh://user@dummy/repo
548 548 searching for changes
549 549 remote: remote-changegroup
550 550 abort: remote-changegroup does not support ssh urls
551 551 [255]
552 552
553 553 Not a bundle
554 554
555 555 $ cat > notbundle.hg << EOF
556 556 > foo
557 557 > EOF
558 558 $ cat > repo/.hg/bundle2maker << EOF
559 559 > remote-changegroup http://localhost:$HGPORT/notbundle.hg notbundle.hg
560 560 > EOF
561 561 $ hg pull -R clone ssh://user@dummy/repo
562 562 pulling from ssh://user@dummy/repo
563 563 searching for changes
564 564 remote: remote-changegroup
565 565 abort: http://localhost:$HGPORT/notbundle.hg: not a Mercurial bundle
566 566 [255]
567 567
568 568 Not a bundle 1.0
569 569
570 570 $ cat > notbundle10.hg << EOF
571 571 > HG20
572 572 > EOF
573 573 $ cat > repo/.hg/bundle2maker << EOF
574 574 > remote-changegroup http://localhost:$HGPORT/notbundle10.hg notbundle10.hg
575 575 > EOF
576 576 $ hg pull -R clone ssh://user@dummy/repo
577 577 pulling from ssh://user@dummy/repo
578 578 searching for changes
579 579 remote: remote-changegroup
580 580 abort: http://localhost:$HGPORT/notbundle10.hg: not a bundle version 1.0
581 581 [255]
582 582
583 583 $ hg -R clone log -G
584 584 @ 2:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> C
585 585 |
586 586 o 1:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> B
587 587 |
588 588 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
589 589
590 590 $ rm -rf clone
591 591
592 592 $ killdaemons.py
@@ -1,235 +1,235 b''
1 1 This test tries to exercise the ssh functionality with a dummy script
2 2
3 3 $ checknewrepo()
4 4 > {
5 5 > name=$1
6 6 > if [ -d "$name"/.hg/store ]; then
7 7 > echo store created
8 8 > fi
9 9 > if [ -f "$name"/.hg/00changelog.i ]; then
10 10 > echo 00changelog.i created
11 11 > fi
12 12 > cat "$name"/.hg/requires
13 13 > }
14 14
15 15 creating 'local'
16 16
17 17 $ hg init local
18 18 $ checknewrepo local
19 19 store created
20 20 00changelog.i created
21 21 dotencode
22 22 fncache
23 23 revlogv1
24 24 store
25 25 $ echo this > local/foo
26 26 $ hg ci --cwd local -A -m "init"
27 27 adding foo
28 28
29 29 test custom revlog chunk cache sizes
30 30
31 31 $ hg --config format.chunkcachesize=0 log -R local -pv
32 32 abort: revlog chunk cache size 0 is not greater than 0!
33 33 [255]
34 34 $ hg --config format.chunkcachesize=1023 log -R local -pv
35 35 abort: revlog chunk cache size 1023 is not a power of 2!
36 36 [255]
37 37 $ hg --config format.chunkcachesize=1024 log -R local -pv
38 38 changeset: 0:08b9e9f63b32
39 39 tag: tip
40 40 user: test
41 41 date: Thu Jan 01 00:00:00 1970 +0000
42 42 files: foo
43 43 description:
44 44 init
45 45
46 46
47 47 diff -r 000000000000 -r 08b9e9f63b32 foo
48 48 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
49 49 +++ b/foo Thu Jan 01 00:00:00 1970 +0000
50 50 @@ -0,0 +1,1 @@
51 51 +this
52 52
53 53
54 54 creating repo with format.usestore=false
55 55
56 56 $ hg --config format.usestore=false init old
57 57 $ checknewrepo old
58 58 revlogv1
59 59
60 60 creating repo with format.usefncache=false
61 61
62 62 $ hg --config format.usefncache=false init old2
63 63 $ checknewrepo old2
64 64 store created
65 65 00changelog.i created
66 66 revlogv1
67 67 store
68 68
69 69 creating repo with format.dotencode=false
70 70
71 71 $ hg --config format.dotencode=false init old3
72 72 $ checknewrepo old3
73 73 store created
74 74 00changelog.i created
75 75 fncache
76 76 revlogv1
77 77 store
78 78
79 79 test failure
80 80
81 81 $ hg init local
82 82 abort: repository local already exists!
83 83 [255]
84 84
85 85 init+push to remote2
86 86
87 $ hg init -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote2
87 $ hg init -e dummyssh ssh://user@dummy/remote2
88 88 $ hg incoming -R remote2 local
89 89 comparing with local
90 90 changeset: 0:08b9e9f63b32
91 91 tag: tip
92 92 user: test
93 93 date: Thu Jan 01 00:00:00 1970 +0000
94 94 summary: init
95 95
96 96
97 $ hg push -R local -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote2
97 $ hg push -R local -e dummyssh ssh://user@dummy/remote2
98 98 pushing to ssh://user@dummy/remote2
99 99 searching for changes
100 100 remote: adding changesets
101 101 remote: adding manifests
102 102 remote: adding file changes
103 103 remote: added 1 changesets with 1 changes to 1 files
104 104
105 105 clone to remote1
106 106
107 $ hg clone -e "python \"$TESTDIR/dummyssh\"" local ssh://user@dummy/remote1
107 $ hg clone -e dummyssh local ssh://user@dummy/remote1
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
114 114 The largefiles extension doesn't crash
115 $ hg clone -e "python \"$TESTDIR/dummyssh\"" local ssh://user@dummy/remotelf --config extensions.largefiles=
115 $ hg clone -e dummyssh local ssh://user@dummy/remotelf --config extensions.largefiles=
116 116 searching for changes
117 117 remote: adding changesets
118 118 remote: adding manifests
119 119 remote: adding file changes
120 120 remote: added 1 changesets with 1 changes to 1 files
121 121
122 122 init to existing repo
123 123
124 $ hg init -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote1
124 $ hg init -e dummyssh ssh://user@dummy/remote1
125 125 abort: repository remote1 already exists!
126 126 abort: could not create remote repo!
127 127 [255]
128 128
129 129 clone to existing repo
130 130
131 $ hg clone -e "python \"$TESTDIR/dummyssh\"" local ssh://user@dummy/remote1
131 $ hg clone -e dummyssh local ssh://user@dummy/remote1
132 132 abort: repository remote1 already exists!
133 133 abort: could not create remote repo!
134 134 [255]
135 135
136 136 output of dummyssh
137 137
138 138 $ cat dummylog
139 139 Got arguments 1:user@dummy 2:hg init remote2
140 140 Got arguments 1:user@dummy 2:hg -R remote2 serve --stdio
141 141 Got arguments 1:user@dummy 2:hg -R remote2 serve --stdio
142 142 Got arguments 1:user@dummy 2:hg init remote1
143 143 Got arguments 1:user@dummy 2:hg -R remote1 serve --stdio
144 144 Got arguments 1:user@dummy 2:hg init remotelf
145 145 Got arguments 1:user@dummy 2:hg -R remotelf serve --stdio
146 146 Got arguments 1:user@dummy 2:hg init remote1
147 147 Got arguments 1:user@dummy 2:hg init remote1
148 148
149 149 comparing repositories
150 150
151 151 $ hg tip -q -R local
152 152 0:08b9e9f63b32
153 153 $ hg tip -q -R remote1
154 154 0:08b9e9f63b32
155 155 $ hg tip -q -R remote2
156 156 0:08b9e9f63b32
157 157
158 158 check names for repositories (clashes with URL schemes, special chars)
159 159
160 160 $ for i in bundle file hg http https old-http ssh static-http "with space"; do
161 161 > printf "hg init \"$i\"... "
162 162 > hg init "$i"
163 163 > test -d "$i" -a -d "$i/.hg" && echo "ok" || echo "failed"
164 164 > done
165 165 hg init "bundle"... ok
166 166 hg init "file"... ok
167 167 hg init "hg"... ok
168 168 hg init "http"... ok
169 169 hg init "https"... ok
170 170 hg init "old-http"... ok
171 171 hg init "ssh"... ok
172 172 hg init "static-http"... ok
173 173 hg init "with space"... ok
174 174 #if eol-in-paths
175 175 /* " " is not a valid name for a directory on Windows */
176 176 $ hg init " "
177 177 $ test -d " "
178 178 $ test -d " /.hg"
179 179 #endif
180 180
181 181 creating 'local/sub/repo'
182 182
183 183 $ hg init local/sub/repo
184 184 $ checknewrepo local/sub/repo
185 185 store created
186 186 00changelog.i created
187 187 dotencode
188 188 fncache
189 189 revlogv1
190 190 store
191 191
192 192 prepare test of init of url configured from paths
193 193
194 194 $ echo '[paths]' >> $HGRCPATH
195 195 $ echo "somewhere = `pwd`/url from paths" >> $HGRCPATH
196 196 $ echo "elsewhere = `pwd`/another paths url" >> $HGRCPATH
197 197
198 198 init should (for consistency with clone) expand the url
199 199
200 200 $ hg init somewhere
201 201 $ checknewrepo "url from paths"
202 202 store created
203 203 00changelog.i created
204 204 dotencode
205 205 fncache
206 206 revlogv1
207 207 store
208 208
209 209 verify that clone also expand urls
210 210
211 211 $ hg clone somewhere elsewhere
212 212 updating to branch default
213 213 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
214 214 $ checknewrepo "another paths url"
215 215 store created
216 216 00changelog.i created
217 217 dotencode
218 218 fncache
219 219 revlogv1
220 220 store
221 221
222 222 clone bookmarks
223 223
224 224 $ hg -R local bookmark test
225 225 $ hg -R local bookmarks
226 226 * test 0:08b9e9f63b32
227 $ hg clone -e "python \"$TESTDIR/dummyssh\"" local ssh://user@dummy/remote-bookmarks
227 $ hg clone -e dummyssh local ssh://user@dummy/remote-bookmarks
228 228 searching for changes
229 229 remote: adding changesets
230 230 remote: adding manifests
231 231 remote: adding file changes
232 232 remote: added 1 changesets with 1 changes to 1 files
233 233 exporting bookmark test
234 234 $ hg -R remote-bookmarks bookmarks
235 235 test 0:08b9e9f63b32
@@ -1,296 +1,296 b''
1 1 This file contains testcases that tend to be related to the wire protocol part
2 2 of largefiles.
3 3
4 4 $ USERCACHE="$TESTTMP/cache"; export USERCACHE
5 5 $ mkdir "${USERCACHE}"
6 6 $ cat >> $HGRCPATH <<EOF
7 7 > [extensions]
8 8 > largefiles=
9 9 > purge=
10 10 > rebase=
11 11 > transplant=
12 12 > [phases]
13 13 > publish=False
14 14 > [largefiles]
15 15 > minsize=2
16 16 > patterns=glob:**.dat
17 17 > usercache=${USERCACHE}
18 18 > [hooks]
19 19 > precommit=sh -c "echo \\"Invoking status precommit hook\\"; hg status"
20 20 > EOF
21 21
22 22
23 23 #if serve
24 24 vanilla clients not locked out from largefiles servers on vanilla repos
25 25 $ mkdir r1
26 26 $ cd r1
27 27 $ hg init
28 28 $ echo c1 > f1
29 29 $ hg add f1
30 30 $ hg commit -m "m1"
31 31 Invoking status precommit hook
32 32 A f1
33 33 $ cd ..
34 34 $ hg serve -R r1 -d -p $HGPORT --pid-file hg.pid
35 35 $ cat hg.pid >> $DAEMON_PIDS
36 36 $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT r2
37 37 requesting all changes
38 38 adding changesets
39 39 adding manifests
40 40 adding file changes
41 41 added 1 changesets with 1 changes to 1 files
42 42 updating to branch default
43 43 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
44 44
45 45 largefiles clients still work with vanilla servers
46 46 $ hg --config extensions.largefiles=! serve -R r1 -d -p $HGPORT1 --pid-file hg.pid
47 47 $ cat hg.pid >> $DAEMON_PIDS
48 48 $ hg clone http://localhost:$HGPORT1 r3
49 49 requesting all changes
50 50 adding changesets
51 51 adding manifests
52 52 adding file changes
53 53 added 1 changesets with 1 changes to 1 files
54 54 updating to branch default
55 55 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
56 56 #endif
57 57
58 58 vanilla clients locked out from largefiles http repos
59 59 $ mkdir r4
60 60 $ cd r4
61 61 $ hg init
62 62 $ echo c1 > f1
63 63 $ hg add --large f1
64 64 $ hg commit -m "m1"
65 65 Invoking status precommit hook
66 66 A f1
67 67 $ cd ..
68 68
69 69 largefiles can be pushed locally (issue3583)
70 70 $ hg init dest
71 71 $ cd r4
72 72 $ hg outgoing ../dest
73 73 comparing with ../dest
74 74 searching for changes
75 75 changeset: 0:639881c12b4c
76 76 tag: tip
77 77 user: test
78 78 date: Thu Jan 01 00:00:00 1970 +0000
79 79 summary: m1
80 80
81 81 $ hg push ../dest
82 82 pushing to ../dest
83 83 searching for changes
84 84 adding changesets
85 85 adding manifests
86 86 adding file changes
87 87 added 1 changesets with 1 changes to 1 files
88 88
89 89 exit code with nothing outgoing (issue3611)
90 90 $ hg outgoing ../dest
91 91 comparing with ../dest
92 92 searching for changes
93 93 no changes found
94 94 [1]
95 95 $ cd ..
96 96
97 97 #if serve
98 98 $ hg serve -R r4 -d -p $HGPORT2 --pid-file hg.pid
99 99 $ cat hg.pid >> $DAEMON_PIDS
100 100 $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT2 r5
101 101 abort: remote error:
102 102
103 103 This repository uses the largefiles extension.
104 104
105 105 Please enable it in your Mercurial config file.
106 106 [255]
107 107
108 108 used all HGPORTs, kill all daemons
109 109 $ killdaemons.py
110 110 #endif
111 111
112 112 vanilla clients locked out from largefiles ssh repos
113 $ hg --config extensions.largefiles=! clone -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/r4 r5
113 $ hg --config extensions.largefiles=! clone -e dummyssh ssh://user@dummy/r4 r5
114 114 remote:
115 115 remote: This repository uses the largefiles extension.
116 116 remote:
117 117 remote: Please enable it in your Mercurial config file.
118 118 remote:
119 119 remote: -
120 120 abort: remote error
121 121 (check previous remote output)
122 122 [255]
123 123
124 124 #if serve
125 125
126 126 largefiles clients refuse to push largefiles repos to vanilla servers
127 127 $ mkdir r6
128 128 $ cd r6
129 129 $ hg init
130 130 $ echo c1 > f1
131 131 $ hg add f1
132 132 $ hg commit -m "m1"
133 133 Invoking status precommit hook
134 134 A f1
135 135 $ cat >> .hg/hgrc <<!
136 136 > [web]
137 137 > push_ssl = false
138 138 > allow_push = *
139 139 > !
140 140 $ cd ..
141 141 $ hg clone r6 r7
142 142 updating to branch default
143 143 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
144 144 $ cd r7
145 145 $ echo c2 > f2
146 146 $ hg add --large f2
147 147 $ hg commit -m "m2"
148 148 Invoking status precommit hook
149 149 A f2
150 150 $ hg --config extensions.largefiles=! -R ../r6 serve -d -p $HGPORT --pid-file ../hg.pid
151 151 $ cat ../hg.pid >> $DAEMON_PIDS
152 152 $ hg push http://localhost:$HGPORT
153 153 pushing to http://localhost:$HGPORT/
154 154 searching for changes
155 155 abort: http://localhost:$HGPORT/ does not appear to be a largefile store
156 156 [255]
157 157 $ cd ..
158 158
159 159 putlfile errors are shown (issue3123)
160 160 Corrupt the cached largefile in r7 and move it out of the servers usercache
161 161 $ mv r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 .
162 162 $ echo 'client side corruption' > r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
163 163 $ rm "$USERCACHE/4cdac4d8b084d0b599525cf732437fb337d422a8"
164 164 $ hg init empty
165 165 $ hg serve -R empty -d -p $HGPORT1 --pid-file hg.pid \
166 166 > --config 'web.allow_push=*' --config web.push_ssl=False
167 167 $ cat hg.pid >> $DAEMON_PIDS
168 168 $ hg push -R r7 http://localhost:$HGPORT1
169 169 pushing to http://localhost:$HGPORT1/
170 170 searching for changes
171 171 remote: largefiles: failed to put 4cdac4d8b084d0b599525cf732437fb337d422a8 into store: largefile contents do not match hash
172 172 abort: remotestore: could not put $TESTTMP/r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 to remote store http://localhost:$HGPORT1/ (glob)
173 173 [255]
174 174 $ mv 4cdac4d8b084d0b599525cf732437fb337d422a8 r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
175 175 Push of file that exists on server but is corrupted - magic healing would be nice ... but too magic
176 176 $ echo "server side corruption" > empty/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
177 177 $ hg push -R r7 http://localhost:$HGPORT1
178 178 pushing to http://localhost:$HGPORT1/
179 179 searching for changes
180 180 remote: adding changesets
181 181 remote: adding manifests
182 182 remote: adding file changes
183 183 remote: added 2 changesets with 2 changes to 2 files
184 184 $ cat empty/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
185 185 server side corruption
186 186 $ rm -rf empty
187 187
188 188 Push a largefiles repository to a served empty repository
189 189 $ hg init r8
190 190 $ echo c3 > r8/f1
191 191 $ hg add --large r8/f1 -R r8
192 192 $ hg commit -m "m1" -R r8
193 193 Invoking status precommit hook
194 194 A f1
195 195 $ hg init empty
196 196 $ hg serve -R empty -d -p $HGPORT2 --pid-file hg.pid \
197 197 > --config 'web.allow_push=*' --config web.push_ssl=False
198 198 $ cat hg.pid >> $DAEMON_PIDS
199 199 $ rm "${USERCACHE}"/*
200 200 $ hg push -R r8 http://localhost:$HGPORT2/#default
201 201 pushing to http://localhost:$HGPORT2/
202 202 searching for changes
203 203 remote: adding changesets
204 204 remote: adding manifests
205 205 remote: adding file changes
206 206 remote: added 1 changesets with 1 changes to 1 files
207 207 $ [ -f "${USERCACHE}"/02a439e5c31c526465ab1a0ca1f431f76b827b90 ]
208 208 $ [ -f empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 ]
209 209
210 210 Clone over http, no largefiles pulled on clone.
211 211
212 212 $ hg clone http://localhost:$HGPORT2/#default http-clone -U
213 213 adding changesets
214 214 adding manifests
215 215 adding file changes
216 216 added 1 changesets with 1 changes to 1 files
217 217
218 218 test 'verify' with remotestore:
219 219
220 220 $ rm "${USERCACHE}"/02a439e5c31c526465ab1a0ca1f431f76b827b90
221 221 $ mv empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 .
222 222 $ hg -R http-clone verify --large --lfa
223 223 checking changesets
224 224 checking manifests
225 225 crosschecking files in changesets and manifests
226 226 checking files
227 227 1 files, 1 changesets, 1 total revisions
228 228 searching 1 changesets for largefiles
229 229 changeset 0:cf03e5bb9936: f1 missing
230 230 verified existence of 1 revisions of 1 largefiles
231 231 [1]
232 232 $ mv 02a439e5c31c526465ab1a0ca1f431f76b827b90 empty/.hg/largefiles/
233 233 $ hg -R http-clone -q verify --large --lfa
234 234
235 235 largefiles pulled on update - a largefile missing on the server:
236 236 $ mv empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 .
237 237 $ hg -R http-clone up --config largefiles.usercache=http-clone-usercache
238 238 getting changed largefiles
239 239 f1: largefile 02a439e5c31c526465ab1a0ca1f431f76b827b90 not available from http://localhost:$HGPORT2/
240 240 0 largefiles updated, 0 removed
241 241 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
242 242 $ hg -R http-clone st
243 243 ! f1
244 244 $ hg -R http-clone up -Cqr null
245 245
246 246 largefiles pulled on update - a largefile corrupted on the server:
247 247 $ echo corruption > empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90
248 248 $ hg -R http-clone up --config largefiles.usercache=http-clone-usercache
249 249 getting changed largefiles
250 250 f1: data corruption (expected 02a439e5c31c526465ab1a0ca1f431f76b827b90, got 6a7bb2556144babe3899b25e5428123735bb1e27)
251 251 0 largefiles updated, 0 removed
252 252 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
253 253 $ hg -R http-clone st
254 254 ! f1
255 255 $ [ ! -f http-clone/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 ]
256 256 $ [ ! -f http-clone/f1 ]
257 257 $ [ ! -f http-clone-usercache ]
258 258 $ hg -R http-clone verify --large --lfc
259 259 checking changesets
260 260 checking manifests
261 261 crosschecking files in changesets and manifests
262 262 checking files
263 263 1 files, 1 changesets, 1 total revisions
264 264 searching 1 changesets for largefiles
265 265 verified contents of 1 revisions of 1 largefiles
266 266 $ hg -R http-clone up -Cqr null
267 267
268 268 largefiles pulled on update - no server side problems:
269 269 $ mv 02a439e5c31c526465ab1a0ca1f431f76b827b90 empty/.hg/largefiles/
270 270 $ hg -R http-clone --debug up --config largefiles.usercache=http-clone-usercache --config progress.debug=true
271 271 resolving manifests
272 272 branchmerge: False, force: False, partial: False
273 273 ancestor: 000000000000, local: 000000000000+, remote: cf03e5bb9936
274 274 .hglf/f1: remote created -> g
275 275 getting .hglf/f1
276 276 updating: .hglf/f1 1/1 files (100.00%)
277 277 getting changed largefiles
278 278 using http://localhost:$HGPORT2/
279 279 sending capabilities command
280 280 sending batch command
281 281 getting largefiles: 0/1 lfile (0.00%)
282 282 getting f1:02a439e5c31c526465ab1a0ca1f431f76b827b90
283 283 sending getlfile command
284 284 found 02a439e5c31c526465ab1a0ca1f431f76b827b90 in store
285 285 1 largefiles updated, 0 removed
286 286 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
287 287
288 288 $ ls http-clone-usercache/*
289 289 http-clone-usercache/02a439e5c31c526465ab1a0ca1f431f76b827b90
290 290
291 291 $ rm -rf empty http-clone*
292 292
293 293 used all HGPORTs, kill all daemons
294 294 $ killdaemons.py
295 295
296 296 #endif
@@ -1,512 +1,512 b''
1 1 This test is a duplicate of 'test-http.t' feel free to factor out
2 2 parts that are not bundle1/bundle2 specific.
3 3
4 4 $ cat << EOF >> $HGRCPATH
5 5 > [experimental]
6 6 > # This test is dedicated to interaction through old bundle
7 7 > bundle2-exp = False
8 8 > EOF
9 9
10 10
11 11 This test tries to exercise the ssh functionality with a dummy script
12 12
13 13 creating 'remote' repo
14 14
15 15 $ hg init remote
16 16 $ cd remote
17 17 $ echo this > foo
18 18 $ echo this > fooO
19 19 $ hg ci -A -m "init" foo fooO
20 20
21 21 insert a closed branch (issue4428)
22 22
23 23 $ hg up null
24 24 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
25 25 $ hg branch closed
26 26 marked working directory as branch closed
27 27 (branches are permanent and global, did you want a bookmark?)
28 28 $ hg ci -mc0
29 29 $ hg ci --close-branch -mc1
30 30 $ hg up -q default
31 31
32 32 configure for serving
33 33
34 34 $ cat <<EOF > .hg/hgrc
35 35 > [server]
36 36 > uncompressed = True
37 37 >
38 38 > [hooks]
39 39 > changegroup = python "$TESTDIR/printenv.py" changegroup-in-remote 0 ../dummylog
40 40 > EOF
41 41 $ cd ..
42 42
43 43 repo not found error
44 44
45 $ hg clone -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/nonexistent local
45 $ hg clone -e dummyssh ssh://user@dummy/nonexistent local
46 46 remote: abort: there is no Mercurial repository here (.hg not found)!
47 47 abort: no suitable response from remote hg!
48 48 [255]
49 49
50 50 non-existent absolute path
51 51
52 $ hg clone -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy//`pwd`/nonexistent local
52 $ hg clone -e dummyssh ssh://user@dummy//`pwd`/nonexistent local
53 53 remote: abort: there is no Mercurial repository here (.hg not found)!
54 54 abort: no suitable response from remote hg!
55 55 [255]
56 56
57 57 clone remote via stream
58 58
59 $ hg clone -e "python \"$TESTDIR/dummyssh\"" --uncompressed ssh://user@dummy/remote local-stream
59 $ hg clone -e dummyssh --uncompressed ssh://user@dummy/remote local-stream
60 60 streaming all changes
61 61 4 files to transfer, 615 bytes of data
62 62 transferred 615 bytes in * seconds (*) (glob)
63 63 searching for changes
64 64 no changes found
65 65 updating to branch default
66 66 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
67 67 $ cd local-stream
68 68 $ hg verify
69 69 checking changesets
70 70 checking manifests
71 71 crosschecking files in changesets and manifests
72 72 checking files
73 73 2 files, 3 changesets, 2 total revisions
74 74 $ hg branches
75 75 default 0:1160648e36ce
76 76 $ cd ..
77 77
78 78 clone bookmarks via stream
79 79
80 80 $ hg -R local-stream book mybook
81 $ hg clone -e "python \"$TESTDIR/dummyssh\"" --uncompressed ssh://user@dummy/local-stream stream2
81 $ hg clone -e dummyssh --uncompressed ssh://user@dummy/local-stream stream2
82 82 streaming all changes
83 83 4 files to transfer, 615 bytes of data
84 84 transferred 615 bytes in * seconds (*) (glob)
85 85 searching for changes
86 86 no changes found
87 87 updating to branch default
88 88 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
89 89 $ cd stream2
90 90 $ hg book
91 91 mybook 0:1160648e36ce
92 92 $ cd ..
93 93 $ rm -rf local-stream stream2
94 94
95 95 clone remote via pull
96 96
97 $ hg clone -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote local
97 $ hg clone -e dummyssh ssh://user@dummy/remote local
98 98 requesting all changes
99 99 adding changesets
100 100 adding manifests
101 101 adding file changes
102 102 added 3 changesets with 2 changes to 2 files
103 103 updating to branch default
104 104 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
105 105
106 106 verify
107 107
108 108 $ cd local
109 109 $ hg verify
110 110 checking changesets
111 111 checking manifests
112 112 crosschecking files in changesets and manifests
113 113 checking files
114 114 2 files, 3 changesets, 2 total revisions
115 115 $ echo '[hooks]' >> .hg/hgrc
116 116 $ echo "changegroup = python \"$TESTDIR/printenv.py\" changegroup-in-local 0 ../dummylog" >> .hg/hgrc
117 117
118 118 empty default pull
119 119
120 120 $ hg paths
121 121 default = ssh://user@dummy/remote
122 $ hg pull -e "python \"$TESTDIR/dummyssh\""
122 $ hg pull -e dummyssh
123 123 pulling from ssh://user@dummy/remote
124 124 searching for changes
125 125 no changes found
126 126
127 127 pull from wrong ssh URL
128 128
129 $ hg pull -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/doesnotexist
129 $ hg pull -e dummyssh ssh://user@dummy/doesnotexist
130 130 pulling from ssh://user@dummy/doesnotexist
131 131 remote: abort: there is no Mercurial repository here (.hg not found)!
132 132 abort: no suitable response from remote hg!
133 133 [255]
134 134
135 135 local change
136 136
137 137 $ echo bleah > foo
138 138 $ hg ci -m "add"
139 139
140 140 updating rc
141 141
142 142 $ echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc
143 143 $ echo "[ui]" >> .hg/hgrc
144 $ echo "ssh = python \"$TESTDIR/dummyssh\"" >> .hg/hgrc
144 $ echo "ssh = dummyssh" >> .hg/hgrc
145 145
146 146 find outgoing
147 147
148 148 $ hg out ssh://user@dummy/remote
149 149 comparing with ssh://user@dummy/remote
150 150 searching for changes
151 151 changeset: 3:a28a9d1a809c
152 152 tag: tip
153 153 parent: 0:1160648e36ce
154 154 user: test
155 155 date: Thu Jan 01 00:00:00 1970 +0000
156 156 summary: add
157 157
158 158
159 159 find incoming on the remote side
160 160
161 $ hg incoming -R ../remote -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/local
161 $ hg incoming -R ../remote -e dummyssh ssh://user@dummy/local
162 162 comparing with ssh://user@dummy/local
163 163 searching for changes
164 164 changeset: 3:a28a9d1a809c
165 165 tag: tip
166 166 parent: 0:1160648e36ce
167 167 user: test
168 168 date: Thu Jan 01 00:00:00 1970 +0000
169 169 summary: add
170 170
171 171
172 172 find incoming on the remote side (using absolute path)
173 173
174 $ hg incoming -R ../remote -e "python \"$TESTDIR/dummyssh\"" "ssh://user@dummy/`pwd`"
174 $ hg incoming -R ../remote -e dummyssh "ssh://user@dummy/`pwd`"
175 175 comparing with ssh://user@dummy/$TESTTMP/local
176 176 searching for changes
177 177 changeset: 3:a28a9d1a809c
178 178 tag: tip
179 179 parent: 0:1160648e36ce
180 180 user: test
181 181 date: Thu Jan 01 00:00:00 1970 +0000
182 182 summary: add
183 183
184 184
185 185 push
186 186
187 187 $ hg push
188 188 pushing to ssh://user@dummy/remote
189 189 searching for changes
190 190 remote: adding changesets
191 191 remote: adding manifests
192 192 remote: adding file changes
193 193 remote: added 1 changesets with 1 changes to 1 files
194 194 $ cd ../remote
195 195
196 196 check remote tip
197 197
198 198 $ hg tip
199 199 changeset: 3:a28a9d1a809c
200 200 tag: tip
201 201 parent: 0:1160648e36ce
202 202 user: test
203 203 date: Thu Jan 01 00:00:00 1970 +0000
204 204 summary: add
205 205
206 206 $ hg verify
207 207 checking changesets
208 208 checking manifests
209 209 crosschecking files in changesets and manifests
210 210 checking files
211 211 2 files, 4 changesets, 3 total revisions
212 212 $ hg cat -r tip foo
213 213 bleah
214 214 $ echo z > z
215 215 $ hg ci -A -m z z
216 216 created new head
217 217
218 218 test pushkeys and bookmarks
219 219
220 220 $ cd ../local
221 $ hg debugpushkey --config ui.ssh="python \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote namespaces
221 $ hg debugpushkey --config ui.ssh=dummyssh ssh://user@dummy/remote namespaces
222 222 bookmarks
223 223 namespaces
224 224 phases
225 225 $ hg book foo -r 0
226 226 $ hg out -B
227 227 comparing with ssh://user@dummy/remote
228 228 searching for changed bookmarks
229 229 foo 1160648e36ce
230 230 $ hg push -B foo
231 231 pushing to ssh://user@dummy/remote
232 232 searching for changes
233 233 no changes found
234 234 exporting bookmark foo
235 235 [1]
236 $ hg debugpushkey --config ui.ssh="python \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote bookmarks
236 $ hg debugpushkey --config ui.ssh=dummyssh ssh://user@dummy/remote bookmarks
237 237 foo 1160648e36cec0054048a7edc4110c6f84fde594
238 238 $ hg book -f foo
239 239 $ hg push --traceback
240 240 pushing to ssh://user@dummy/remote
241 241 searching for changes
242 242 no changes found
243 243 updating bookmark foo
244 244 [1]
245 245 $ hg book -d foo
246 246 $ hg in -B
247 247 comparing with ssh://user@dummy/remote
248 248 searching for changed bookmarks
249 249 foo a28a9d1a809c
250 250 $ hg book -f -r 0 foo
251 251 $ hg pull -B foo
252 252 pulling from ssh://user@dummy/remote
253 253 no changes found
254 254 updating bookmark foo
255 255 $ hg book -d foo
256 256 $ hg push -B foo
257 257 pushing to ssh://user@dummy/remote
258 258 searching for changes
259 259 no changes found
260 260 deleting remote bookmark foo
261 261 [1]
262 262
263 263 a bad, evil hook that prints to stdout
264 264
265 265 $ cat <<EOF > $TESTTMP/badhook
266 266 > import sys
267 267 > sys.stdout.write("KABOOM\n")
268 268 > EOF
269 269
270 270 $ echo '[hooks]' >> ../remote/.hg/hgrc
271 271 $ echo "changegroup.stdout = python $TESTTMP/badhook" >> ../remote/.hg/hgrc
272 272 $ echo r > r
273 273 $ hg ci -A -m z r
274 274
275 275 push should succeed even though it has an unexpected response
276 276
277 277 $ hg push
278 278 pushing to ssh://user@dummy/remote
279 279 searching for changes
280 280 remote has heads on branch 'default' that are not known locally: 6c0482d977a3
281 281 remote: adding changesets
282 282 remote: adding manifests
283 283 remote: adding file changes
284 284 remote: added 1 changesets with 1 changes to 1 files
285 285 remote: KABOOM
286 286 $ hg -R ../remote heads
287 287 changeset: 5:1383141674ec
288 288 tag: tip
289 289 parent: 3:a28a9d1a809c
290 290 user: test
291 291 date: Thu Jan 01 00:00:00 1970 +0000
292 292 summary: z
293 293
294 294 changeset: 4:6c0482d977a3
295 295 parent: 0:1160648e36ce
296 296 user: test
297 297 date: Thu Jan 01 00:00:00 1970 +0000
298 298 summary: z
299 299
300 300
301 301 clone bookmarks
302 302
303 303 $ hg -R ../remote bookmark test
304 304 $ hg -R ../remote bookmarks
305 305 * test 4:6c0482d977a3
306 $ hg clone -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote local-bookmarks
306 $ hg clone -e dummyssh ssh://user@dummy/remote local-bookmarks
307 307 requesting all changes
308 308 adding changesets
309 309 adding manifests
310 310 adding file changes
311 311 added 6 changesets with 5 changes to 4 files (+1 heads)
312 312 updating to branch default
313 313 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
314 314 $ hg -R local-bookmarks bookmarks
315 315 test 4:6c0482d977a3
316 316
317 317 passwords in ssh urls are not supported
318 318 (we use a glob here because different Python versions give different
319 319 results here)
320 320
321 321 $ hg push ssh://user:erroneouspwd@dummy/remote
322 322 pushing to ssh://user:*@dummy/remote (glob)
323 323 abort: password in URL not supported!
324 324 [255]
325 325
326 326 $ cd ..
327 327
328 328 hide outer repo
329 329 $ hg init
330 330
331 331 Test remote paths with spaces (issue2983):
332 332
333 $ hg init --ssh "python \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
333 $ hg init --ssh dummyssh "ssh://user@dummy/a repo"
334 334 $ touch "$TESTTMP/a repo/test"
335 335 $ hg -R 'a repo' commit -A -m "test"
336 336 adding test
337 337 $ hg -R 'a repo' tag tag
338 $ hg id --ssh "python \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
338 $ hg id --ssh dummyssh "ssh://user@dummy/a repo"
339 339 73649e48688a
340 340
341 $ hg id --ssh "python \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo#noNoNO"
341 $ hg id --ssh dummyssh "ssh://user@dummy/a repo#noNoNO"
342 342 abort: unknown revision 'noNoNO'!
343 343 [255]
344 344
345 345 Test (non-)escaping of remote paths with spaces when cloning (issue3145):
346 346
347 $ hg clone --ssh "python \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
347 $ hg clone --ssh dummyssh "ssh://user@dummy/a repo"
348 348 destination directory: a repo
349 349 abort: destination 'a repo' is not empty
350 350 [255]
351 351
352 352 Test hg-ssh using a helper script that will restore PYTHONPATH (which might
353 353 have been cleared by a hg.exe wrapper) and invoke hg-ssh with the right
354 354 parameters:
355 355
356 356 $ cat > ssh.sh << EOF
357 357 > userhost="\$1"
358 358 > SSH_ORIGINAL_COMMAND="\$2"
359 359 > export SSH_ORIGINAL_COMMAND
360 360 > PYTHONPATH="$PYTHONPATH"
361 361 > export PYTHONPATH
362 362 > python "$TESTDIR/../contrib/hg-ssh" "$TESTTMP/a repo"
363 363 > EOF
364 364
365 365 $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a repo"
366 366 73649e48688a
367 367
368 368 $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a'repo"
369 369 remote: Illegal repository "$TESTTMP/a'repo" (glob)
370 370 abort: no suitable response from remote hg!
371 371 [255]
372 372
373 373 $ hg id --ssh "sh ssh.sh" --remotecmd hacking "ssh://user@dummy/a'repo"
374 374 remote: Illegal command "hacking -R 'a'\''repo' serve --stdio"
375 375 abort: no suitable response from remote hg!
376 376 [255]
377 377
378 378 $ SSH_ORIGINAL_COMMAND="'hg' -R 'a'repo' serve --stdio" python "$TESTDIR/../contrib/hg-ssh"
379 379 Illegal command "'hg' -R 'a'repo' serve --stdio": No closing quotation
380 380 [255]
381 381
382 382 Test hg-ssh in read-only mode:
383 383
384 384 $ cat > ssh.sh << EOF
385 385 > userhost="\$1"
386 386 > SSH_ORIGINAL_COMMAND="\$2"
387 387 > export SSH_ORIGINAL_COMMAND
388 388 > PYTHONPATH="$PYTHONPATH"
389 389 > export PYTHONPATH
390 390 > python "$TESTDIR/../contrib/hg-ssh" --read-only "$TESTTMP/remote"
391 391 > EOF
392 392
393 393 $ hg clone --ssh "sh ssh.sh" "ssh://user@dummy/$TESTTMP/remote" read-only-local
394 394 requesting all changes
395 395 adding changesets
396 396 adding manifests
397 397 adding file changes
398 398 added 6 changesets with 5 changes to 4 files (+1 heads)
399 399 updating to branch default
400 400 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
401 401
402 402 $ cd read-only-local
403 403 $ echo "baz" > bar
404 404 $ hg ci -A -m "unpushable commit" bar
405 405 $ hg push --ssh "sh ../ssh.sh"
406 406 pushing to ssh://user@dummy/*/remote (glob)
407 407 searching for changes
408 408 remote: Permission denied
409 409 remote: abort: pretxnopen.hg-ssh hook failed
410 410 remote: Permission denied
411 411 remote: pushkey-abort: prepushkey.hg-ssh hook failed
412 412 updating 6c0482d977a3 to public failed!
413 413 [1]
414 414
415 415 $ cd ..
416 416
417 417 stderr from remote commands should be printed before stdout from local code (issue4336)
418 418
419 419 $ hg clone remote stderr-ordering
420 420 updating to branch default
421 421 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
422 422 $ cd stderr-ordering
423 423 $ cat >> localwrite.py << EOF
424 424 > from mercurial import exchange, extensions
425 425 >
426 426 > def wrappedpush(orig, repo, *args, **kwargs):
427 427 > res = orig(repo, *args, **kwargs)
428 428 > repo.ui.write('local stdout\n')
429 429 > return res
430 430 >
431 431 > def extsetup(ui):
432 432 > extensions.wrapfunction(exchange, 'push', wrappedpush)
433 433 > EOF
434 434
435 435 $ cat >> .hg/hgrc << EOF
436 436 > [paths]
437 437 > default-push = ssh://user@dummy/remote
438 438 > [ui]
439 > ssh = python "$TESTDIR/dummyssh"
439 > ssh = dummyssh
440 440 > [extensions]
441 441 > localwrite = localwrite.py
442 442 > EOF
443 443
444 444 $ echo localwrite > foo
445 445 $ hg commit -m 'testing localwrite'
446 446 $ hg push
447 447 pushing to ssh://user@dummy/remote
448 448 searching for changes
449 449 remote: adding changesets
450 450 remote: adding manifests
451 451 remote: adding file changes
452 452 remote: added 1 changesets with 1 changes to 1 files
453 453 remote: KABOOM
454 454 local stdout
455 455
456 456 debug output
457 457
458 458 $ hg pull --debug ssh://user@dummy/remote
459 459 pulling from ssh://user@dummy/remote
460 running python "*/dummyssh" user@dummy 'hg -R remote serve --stdio' (glob)
460 running dummyssh user@dummy 'hg -R remote serve --stdio'
461 461 sending hello command
462 462 sending between command
463 463 remote: 286
464 464 remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch stream bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024
465 465 remote: 1
466 466 preparing listkeys for "bookmarks"
467 467 sending listkeys command
468 468 received listkey for "bookmarks": 45 bytes
469 469 query 1; heads
470 470 sending batch command
471 471 searching for changes
472 472 all remote heads known locally
473 473 no changes found
474 474 preparing listkeys for "phases"
475 475 sending listkeys command
476 476 received listkey for "phases": 15 bytes
477 477 checking for updated bookmarks
478 478
479 479 $ cd ..
480 480
481 481 $ cat dummylog
482 482 Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio
483 483 Got arguments 1:user@dummy 2:hg -R /$TESTTMP/nonexistent serve --stdio
484 484 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
485 485 Got arguments 1:user@dummy 2:hg -R local-stream serve --stdio
486 486 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
487 487 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
488 488 Got arguments 1:user@dummy 2:hg -R doesnotexist serve --stdio
489 489 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
490 490 Got arguments 1:user@dummy 2:hg -R local serve --stdio
491 491 Got arguments 1:user@dummy 2:hg -R $TESTTMP/local serve --stdio
492 492 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
493 493 changegroup-in-remote hook: HG_NODE=a28a9d1a809cab7d4e2fde4bee738a9ede948b60 HG_SOURCE=serve HG_TXNID=TXN:* HG_URL=remote:ssh:127.0.0.1 (glob)
494 494 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
495 495 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
496 496 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
497 497 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
498 498 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
499 499 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
500 500 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
501 501 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
502 502 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
503 503 changegroup-in-remote hook: HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6 HG_SOURCE=serve HG_TXNID=TXN:* HG_URL=remote:ssh:127.0.0.1 (glob)
504 504 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
505 505 Got arguments 1:user@dummy 2:hg init 'a repo'
506 506 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
507 507 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
508 508 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
509 509 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
510 510 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
511 511 changegroup-in-remote hook: HG_NODE=65c38f4125f9602c8db4af56530cc221d93b8ef8 HG_SOURCE=serve HG_TXNID=TXN:* HG_URL=remote:ssh:127.0.0.1 (glob)
512 512 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
@@ -1,195 +1,195 b''
1 1 This test tries to exercise the ssh functionality with a dummy script
2 2
3 3 creating 'remote' repo
4 4
5 5 $ hg init remote
6 6 $ cd remote
7 7 $ hg unbundle "$TESTDIR/bundles/remote.hg"
8 8 adding changesets
9 9 adding manifests
10 10 adding file changes
11 11 added 9 changesets with 7 changes to 4 files (+1 heads)
12 12 (run 'hg heads' to see heads, 'hg merge' to merge)
13 13 $ hg up tip
14 14 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
15 15 $ cd ..
16 16
17 17 clone remote via stream
18 18
19 19 $ for i in 0 1 2 3 4 5 6 7 8; do
20 > hg clone -e "python \"$TESTDIR/dummyssh\"" --uncompressed -r "$i" ssh://user@dummy/remote test-"$i"
20 > hg clone -e dummyssh --uncompressed -r "$i" ssh://user@dummy/remote test-"$i"
21 21 > if cd test-"$i"; then
22 22 > hg verify
23 23 > cd ..
24 24 > fi
25 25 > done
26 26 adding changesets
27 27 adding manifests
28 28 adding file changes
29 29 added 1 changesets with 1 changes to 1 files
30 30 updating to branch default
31 31 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
32 32 checking changesets
33 33 checking manifests
34 34 crosschecking files in changesets and manifests
35 35 checking files
36 36 1 files, 1 changesets, 1 total revisions
37 37 adding changesets
38 38 adding manifests
39 39 adding file changes
40 40 added 2 changesets with 2 changes to 1 files
41 41 updating to branch default
42 42 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
43 43 checking changesets
44 44 checking manifests
45 45 crosschecking files in changesets and manifests
46 46 checking files
47 47 1 files, 2 changesets, 2 total revisions
48 48 adding changesets
49 49 adding manifests
50 50 adding file changes
51 51 added 3 changesets with 3 changes to 1 files
52 52 updating to branch default
53 53 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
54 54 checking changesets
55 55 checking manifests
56 56 crosschecking files in changesets and manifests
57 57 checking files
58 58 1 files, 3 changesets, 3 total revisions
59 59 adding changesets
60 60 adding manifests
61 61 adding file changes
62 62 added 4 changesets with 4 changes to 1 files
63 63 updating to branch default
64 64 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
65 65 checking changesets
66 66 checking manifests
67 67 crosschecking files in changesets and manifests
68 68 checking files
69 69 1 files, 4 changesets, 4 total revisions
70 70 adding changesets
71 71 adding manifests
72 72 adding file changes
73 73 added 2 changesets with 2 changes to 1 files
74 74 updating to branch default
75 75 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
76 76 checking changesets
77 77 checking manifests
78 78 crosschecking files in changesets and manifests
79 79 checking files
80 80 1 files, 2 changesets, 2 total revisions
81 81 adding changesets
82 82 adding manifests
83 83 adding file changes
84 84 added 3 changesets with 3 changes to 1 files
85 85 updating to branch default
86 86 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
87 87 checking changesets
88 88 checking manifests
89 89 crosschecking files in changesets and manifests
90 90 checking files
91 91 1 files, 3 changesets, 3 total revisions
92 92 adding changesets
93 93 adding manifests
94 94 adding file changes
95 95 added 4 changesets with 5 changes to 2 files
96 96 updating to branch default
97 97 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
98 98 checking changesets
99 99 checking manifests
100 100 crosschecking files in changesets and manifests
101 101 checking files
102 102 2 files, 4 changesets, 5 total revisions
103 103 adding changesets
104 104 adding manifests
105 105 adding file changes
106 106 added 5 changesets with 6 changes to 3 files
107 107 updating to branch default
108 108 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
109 109 checking changesets
110 110 checking manifests
111 111 crosschecking files in changesets and manifests
112 112 checking files
113 113 3 files, 5 changesets, 6 total revisions
114 114 adding changesets
115 115 adding manifests
116 116 adding file changes
117 117 added 5 changesets with 5 changes to 2 files
118 118 updating to branch default
119 119 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
120 120 checking changesets
121 121 checking manifests
122 122 crosschecking files in changesets and manifests
123 123 checking files
124 124 2 files, 5 changesets, 5 total revisions
125 125 $ cd test-8
126 126 $ hg pull ../test-7
127 127 pulling from ../test-7
128 128 searching for changes
129 129 adding changesets
130 130 adding manifests
131 131 adding file changes
132 132 added 4 changesets with 2 changes to 3 files (+1 heads)
133 133 (run 'hg heads' to see heads, 'hg merge' to merge)
134 134 $ hg verify
135 135 checking changesets
136 136 checking manifests
137 137 crosschecking files in changesets and manifests
138 138 checking files
139 139 4 files, 9 changesets, 7 total revisions
140 140 $ cd ..
141 141 $ cd test-1
142 $ hg pull -e "python \"$TESTDIR/dummyssh\"" -r 4 ssh://user@dummy/remote
142 $ hg pull -e dummyssh -r 4 ssh://user@dummy/remote
143 143 pulling from ssh://user@dummy/remote
144 144 searching for changes
145 145 adding changesets
146 146 adding manifests
147 147 adding file changes
148 148 added 1 changesets with 0 changes to 0 files (+1 heads)
149 149 (run 'hg heads' to see heads, 'hg merge' to merge)
150 150 $ hg verify
151 151 checking changesets
152 152 checking manifests
153 153 crosschecking files in changesets and manifests
154 154 checking files
155 155 1 files, 3 changesets, 2 total revisions
156 $ hg pull -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote
156 $ hg pull -e dummyssh ssh://user@dummy/remote
157 157 pulling from ssh://user@dummy/remote
158 158 searching for changes
159 159 adding changesets
160 160 adding manifests
161 161 adding file changes
162 162 added 6 changesets with 5 changes to 4 files
163 163 (run 'hg update' to get a working copy)
164 164 $ cd ..
165 165 $ cd test-2
166 $ hg pull -e "python \"$TESTDIR/dummyssh\"" -r 5 ssh://user@dummy/remote
166 $ hg pull -e dummyssh -r 5 ssh://user@dummy/remote
167 167 pulling from ssh://user@dummy/remote
168 168 searching for changes
169 169 adding changesets
170 170 adding manifests
171 171 adding file changes
172 172 added 2 changesets with 0 changes to 0 files (+1 heads)
173 173 (run 'hg heads' to see heads, 'hg merge' to merge)
174 174 $ hg verify
175 175 checking changesets
176 176 checking manifests
177 177 crosschecking files in changesets and manifests
178 178 checking files
179 179 1 files, 5 changesets, 3 total revisions
180 $ hg pull -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote
180 $ hg pull -e dummyssh ssh://user@dummy/remote
181 181 pulling from ssh://user@dummy/remote
182 182 searching for changes
183 183 adding changesets
184 184 adding manifests
185 185 adding file changes
186 186 added 4 changesets with 4 changes to 4 files
187 187 (run 'hg update' to get a working copy)
188 188 $ hg verify
189 189 checking changesets
190 190 checking manifests
191 191 crosschecking files in changesets and manifests
192 192 checking files
193 193 4 files, 9 changesets, 7 total revisions
194 194
195 195 $ cd ..
@@ -1,503 +1,503 b''
1 1
2 2 This test tries to exercise the ssh functionality with a dummy script
3 3
4 4 creating 'remote' repo
5 5
6 6 $ hg init remote
7 7 $ cd remote
8 8 $ echo this > foo
9 9 $ echo this > fooO
10 10 $ hg ci -A -m "init" foo fooO
11 11
12 12 insert a closed branch (issue4428)
13 13
14 14 $ hg up null
15 15 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
16 16 $ hg branch closed
17 17 marked working directory as branch closed
18 18 (branches are permanent and global, did you want a bookmark?)
19 19 $ hg ci -mc0
20 20 $ hg ci --close-branch -mc1
21 21 $ hg up -q default
22 22
23 23 configure for serving
24 24
25 25 $ cat <<EOF > .hg/hgrc
26 26 > [server]
27 27 > uncompressed = True
28 28 >
29 29 > [hooks]
30 30 > changegroup = python "$TESTDIR/printenv.py" changegroup-in-remote 0 ../dummylog
31 31 > EOF
32 32 $ cd ..
33 33
34 34 repo not found error
35 35
36 $ hg clone -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/nonexistent local
36 $ hg clone -e dummyssh ssh://user@dummy/nonexistent local
37 37 remote: abort: there is no Mercurial repository here (.hg not found)!
38 38 abort: no suitable response from remote hg!
39 39 [255]
40 40
41 41 non-existent absolute path
42 42
43 $ hg clone -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy//`pwd`/nonexistent local
43 $ hg clone -e dummyssh ssh://user@dummy//`pwd`/nonexistent local
44 44 remote: abort: there is no Mercurial repository here (.hg not found)!
45 45 abort: no suitable response from remote hg!
46 46 [255]
47 47
48 48 clone remote via stream
49 49
50 $ hg clone -e "python \"$TESTDIR/dummyssh\"" --uncompressed ssh://user@dummy/remote local-stream
50 $ hg clone -e dummyssh --uncompressed ssh://user@dummy/remote local-stream
51 51 streaming all changes
52 52 4 files to transfer, 615 bytes of data
53 53 transferred 615 bytes in * seconds (*) (glob)
54 54 searching for changes
55 55 no changes found
56 56 updating to branch default
57 57 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
58 58 $ cd local-stream
59 59 $ hg verify
60 60 checking changesets
61 61 checking manifests
62 62 crosschecking files in changesets and manifests
63 63 checking files
64 64 2 files, 3 changesets, 2 total revisions
65 65 $ hg branches
66 66 default 0:1160648e36ce
67 67 $ cd ..
68 68
69 69 clone bookmarks via stream
70 70
71 71 $ hg -R local-stream book mybook
72 $ hg clone -e "python \"$TESTDIR/dummyssh\"" --uncompressed ssh://user@dummy/local-stream stream2
72 $ hg clone -e dummyssh --uncompressed ssh://user@dummy/local-stream stream2
73 73 streaming all changes
74 74 4 files to transfer, 615 bytes of data
75 75 transferred 615 bytes in * seconds (*) (glob)
76 76 searching for changes
77 77 no changes found
78 78 updating to branch default
79 79 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
80 80 $ cd stream2
81 81 $ hg book
82 82 mybook 0:1160648e36ce
83 83 $ cd ..
84 84 $ rm -rf local-stream stream2
85 85
86 86 clone remote via pull
87 87
88 $ hg clone -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote local
88 $ hg clone -e dummyssh ssh://user@dummy/remote local
89 89 requesting all changes
90 90 adding changesets
91 91 adding manifests
92 92 adding file changes
93 93 added 3 changesets with 2 changes to 2 files
94 94 updating to branch default
95 95 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
96 96
97 97 verify
98 98
99 99 $ cd local
100 100 $ hg verify
101 101 checking changesets
102 102 checking manifests
103 103 crosschecking files in changesets and manifests
104 104 checking files
105 105 2 files, 3 changesets, 2 total revisions
106 106 $ echo '[hooks]' >> .hg/hgrc
107 107 $ echo "changegroup = python \"$TESTDIR/printenv.py\" changegroup-in-local 0 ../dummylog" >> .hg/hgrc
108 108
109 109 empty default pull
110 110
111 111 $ hg paths
112 112 default = ssh://user@dummy/remote
113 $ hg pull -e "python \"$TESTDIR/dummyssh\""
113 $ hg pull -e dummyssh
114 114 pulling from ssh://user@dummy/remote
115 115 searching for changes
116 116 no changes found
117 117
118 118 pull from wrong ssh URL
119 119
120 $ hg pull -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/doesnotexist
120 $ hg pull -e dummyssh ssh://user@dummy/doesnotexist
121 121 pulling from ssh://user@dummy/doesnotexist
122 122 remote: abort: there is no Mercurial repository here (.hg not found)!
123 123 abort: no suitable response from remote hg!
124 124 [255]
125 125
126 126 local change
127 127
128 128 $ echo bleah > foo
129 129 $ hg ci -m "add"
130 130
131 131 updating rc
132 132
133 133 $ echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc
134 134 $ echo "[ui]" >> .hg/hgrc
135 $ echo "ssh = python \"$TESTDIR/dummyssh\"" >> .hg/hgrc
135 $ echo "ssh = dummyssh" >> .hg/hgrc
136 136
137 137 find outgoing
138 138
139 139 $ hg out ssh://user@dummy/remote
140 140 comparing with ssh://user@dummy/remote
141 141 searching for changes
142 142 changeset: 3:a28a9d1a809c
143 143 tag: tip
144 144 parent: 0:1160648e36ce
145 145 user: test
146 146 date: Thu Jan 01 00:00:00 1970 +0000
147 147 summary: add
148 148
149 149
150 150 find incoming on the remote side
151 151
152 $ hg incoming -R ../remote -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/local
152 $ hg incoming -R ../remote -e dummyssh ssh://user@dummy/local
153 153 comparing with ssh://user@dummy/local
154 154 searching for changes
155 155 changeset: 3:a28a9d1a809c
156 156 tag: tip
157 157 parent: 0:1160648e36ce
158 158 user: test
159 159 date: Thu Jan 01 00:00:00 1970 +0000
160 160 summary: add
161 161
162 162
163 163 find incoming on the remote side (using absolute path)
164 164
165 $ hg incoming -R ../remote -e "python \"$TESTDIR/dummyssh\"" "ssh://user@dummy/`pwd`"
165 $ hg incoming -R ../remote -e dummyssh "ssh://user@dummy/`pwd`"
166 166 comparing with ssh://user@dummy/$TESTTMP/local
167 167 searching for changes
168 168 changeset: 3:a28a9d1a809c
169 169 tag: tip
170 170 parent: 0:1160648e36ce
171 171 user: test
172 172 date: Thu Jan 01 00:00:00 1970 +0000
173 173 summary: add
174 174
175 175
176 176 push
177 177
178 178 $ hg push
179 179 pushing to ssh://user@dummy/remote
180 180 searching for changes
181 181 remote: adding changesets
182 182 remote: adding manifests
183 183 remote: adding file changes
184 184 remote: added 1 changesets with 1 changes to 1 files
185 185 $ cd ../remote
186 186
187 187 check remote tip
188 188
189 189 $ hg tip
190 190 changeset: 3:a28a9d1a809c
191 191 tag: tip
192 192 parent: 0:1160648e36ce
193 193 user: test
194 194 date: Thu Jan 01 00:00:00 1970 +0000
195 195 summary: add
196 196
197 197 $ hg verify
198 198 checking changesets
199 199 checking manifests
200 200 crosschecking files in changesets and manifests
201 201 checking files
202 202 2 files, 4 changesets, 3 total revisions
203 203 $ hg cat -r tip foo
204 204 bleah
205 205 $ echo z > z
206 206 $ hg ci -A -m z z
207 207 created new head
208 208
209 209 test pushkeys and bookmarks
210 210
211 211 $ cd ../local
212 $ hg debugpushkey --config ui.ssh="python \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote namespaces
212 $ hg debugpushkey --config ui.ssh=dummyssh ssh://user@dummy/remote namespaces
213 213 bookmarks
214 214 namespaces
215 215 phases
216 216 $ hg book foo -r 0
217 217 $ hg out -B
218 218 comparing with ssh://user@dummy/remote
219 219 searching for changed bookmarks
220 220 foo 1160648e36ce
221 221 $ hg push -B foo
222 222 pushing to ssh://user@dummy/remote
223 223 searching for changes
224 224 no changes found
225 225 exporting bookmark foo
226 226 [1]
227 $ hg debugpushkey --config ui.ssh="python \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote bookmarks
227 $ hg debugpushkey --config ui.ssh=dummyssh ssh://user@dummy/remote bookmarks
228 228 foo 1160648e36cec0054048a7edc4110c6f84fde594
229 229 $ hg book -f foo
230 230 $ hg push --traceback
231 231 pushing to ssh://user@dummy/remote
232 232 searching for changes
233 233 no changes found
234 234 updating bookmark foo
235 235 [1]
236 236 $ hg book -d foo
237 237 $ hg in -B
238 238 comparing with ssh://user@dummy/remote
239 239 searching for changed bookmarks
240 240 foo a28a9d1a809c
241 241 $ hg book -f -r 0 foo
242 242 $ hg pull -B foo
243 243 pulling from ssh://user@dummy/remote
244 244 no changes found
245 245 updating bookmark foo
246 246 $ hg book -d foo
247 247 $ hg push -B foo
248 248 pushing to ssh://user@dummy/remote
249 249 searching for changes
250 250 no changes found
251 251 deleting remote bookmark foo
252 252 [1]
253 253
254 254 a bad, evil hook that prints to stdout
255 255
256 256 $ cat <<EOF > $TESTTMP/badhook
257 257 > import sys
258 258 > sys.stdout.write("KABOOM\n")
259 259 > EOF
260 260
261 261 $ echo '[hooks]' >> ../remote/.hg/hgrc
262 262 $ echo "changegroup.stdout = python $TESTTMP/badhook" >> ../remote/.hg/hgrc
263 263 $ echo r > r
264 264 $ hg ci -A -m z r
265 265
266 266 push should succeed even though it has an unexpected response
267 267
268 268 $ hg push
269 269 pushing to ssh://user@dummy/remote
270 270 searching for changes
271 271 remote has heads on branch 'default' that are not known locally: 6c0482d977a3
272 272 remote: adding changesets
273 273 remote: adding manifests
274 274 remote: adding file changes
275 275 remote: added 1 changesets with 1 changes to 1 files
276 276 remote: KABOOM
277 277 $ hg -R ../remote heads
278 278 changeset: 5:1383141674ec
279 279 tag: tip
280 280 parent: 3:a28a9d1a809c
281 281 user: test
282 282 date: Thu Jan 01 00:00:00 1970 +0000
283 283 summary: z
284 284
285 285 changeset: 4:6c0482d977a3
286 286 parent: 0:1160648e36ce
287 287 user: test
288 288 date: Thu Jan 01 00:00:00 1970 +0000
289 289 summary: z
290 290
291 291
292 292 clone bookmarks
293 293
294 294 $ hg -R ../remote bookmark test
295 295 $ hg -R ../remote bookmarks
296 296 * test 4:6c0482d977a3
297 $ hg clone -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote local-bookmarks
297 $ hg clone -e dummyssh ssh://user@dummy/remote local-bookmarks
298 298 requesting all changes
299 299 adding changesets
300 300 adding manifests
301 301 adding file changes
302 302 added 6 changesets with 5 changes to 4 files (+1 heads)
303 303 updating to branch default
304 304 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
305 305 $ hg -R local-bookmarks bookmarks
306 306 test 4:6c0482d977a3
307 307
308 308 passwords in ssh urls are not supported
309 309 (we use a glob here because different Python versions give different
310 310 results here)
311 311
312 312 $ hg push ssh://user:erroneouspwd@dummy/remote
313 313 pushing to ssh://user:*@dummy/remote (glob)
314 314 abort: password in URL not supported!
315 315 [255]
316 316
317 317 $ cd ..
318 318
319 319 hide outer repo
320 320 $ hg init
321 321
322 322 Test remote paths with spaces (issue2983):
323 323
324 $ hg init --ssh "python \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
324 $ hg init --ssh dummyssh "ssh://user@dummy/a repo"
325 325 $ touch "$TESTTMP/a repo/test"
326 326 $ hg -R 'a repo' commit -A -m "test"
327 327 adding test
328 328 $ hg -R 'a repo' tag tag
329 $ hg id --ssh "python \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
329 $ hg id --ssh dummyssh "ssh://user@dummy/a repo"
330 330 73649e48688a
331 331
332 $ hg id --ssh "python \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo#noNoNO"
332 $ hg id --ssh dummyssh "ssh://user@dummy/a repo#noNoNO"
333 333 abort: unknown revision 'noNoNO'!
334 334 [255]
335 335
336 336 Test (non-)escaping of remote paths with spaces when cloning (issue3145):
337 337
338 $ hg clone --ssh "python \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
338 $ hg clone --ssh dummyssh "ssh://user@dummy/a repo"
339 339 destination directory: a repo
340 340 abort: destination 'a repo' is not empty
341 341 [255]
342 342
343 343 Test hg-ssh using a helper script that will restore PYTHONPATH (which might
344 344 have been cleared by a hg.exe wrapper) and invoke hg-ssh with the right
345 345 parameters:
346 346
347 347 $ cat > ssh.sh << EOF
348 348 > userhost="\$1"
349 349 > SSH_ORIGINAL_COMMAND="\$2"
350 350 > export SSH_ORIGINAL_COMMAND
351 351 > PYTHONPATH="$PYTHONPATH"
352 352 > export PYTHONPATH
353 353 > python "$TESTDIR/../contrib/hg-ssh" "$TESTTMP/a repo"
354 354 > EOF
355 355
356 356 $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a repo"
357 357 73649e48688a
358 358
359 359 $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a'repo"
360 360 remote: Illegal repository "$TESTTMP/a'repo" (glob)
361 361 abort: no suitable response from remote hg!
362 362 [255]
363 363
364 364 $ hg id --ssh "sh ssh.sh" --remotecmd hacking "ssh://user@dummy/a'repo"
365 365 remote: Illegal command "hacking -R 'a'\''repo' serve --stdio"
366 366 abort: no suitable response from remote hg!
367 367 [255]
368 368
369 369 $ SSH_ORIGINAL_COMMAND="'hg' -R 'a'repo' serve --stdio" python "$TESTDIR/../contrib/hg-ssh"
370 370 Illegal command "'hg' -R 'a'repo' serve --stdio": No closing quotation
371 371 [255]
372 372
373 373 Test hg-ssh in read-only mode:
374 374
375 375 $ cat > ssh.sh << EOF
376 376 > userhost="\$1"
377 377 > SSH_ORIGINAL_COMMAND="\$2"
378 378 > export SSH_ORIGINAL_COMMAND
379 379 > PYTHONPATH="$PYTHONPATH"
380 380 > export PYTHONPATH
381 381 > python "$TESTDIR/../contrib/hg-ssh" --read-only "$TESTTMP/remote"
382 382 > EOF
383 383
384 384 $ hg clone --ssh "sh ssh.sh" "ssh://user@dummy/$TESTTMP/remote" read-only-local
385 385 requesting all changes
386 386 adding changesets
387 387 adding manifests
388 388 adding file changes
389 389 added 6 changesets with 5 changes to 4 files (+1 heads)
390 390 updating to branch default
391 391 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
392 392
393 393 $ cd read-only-local
394 394 $ echo "baz" > bar
395 395 $ hg ci -A -m "unpushable commit" bar
396 396 $ hg push --ssh "sh ../ssh.sh"
397 397 pushing to ssh://user@dummy/*/remote (glob)
398 398 searching for changes
399 399 remote: Permission denied
400 400 abort: pretxnopen.hg-ssh hook failed
401 401 [255]
402 402
403 403 $ cd ..
404 404
405 405 stderr from remote commands should be printed before stdout from local code (issue4336)
406 406
407 407 $ hg clone remote stderr-ordering
408 408 updating to branch default
409 409 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
410 410 $ cd stderr-ordering
411 411 $ cat >> localwrite.py << EOF
412 412 > from mercurial import exchange, extensions
413 413 >
414 414 > def wrappedpush(orig, repo, *args, **kwargs):
415 415 > res = orig(repo, *args, **kwargs)
416 416 > repo.ui.write('local stdout\n')
417 417 > return res
418 418 >
419 419 > def extsetup(ui):
420 420 > extensions.wrapfunction(exchange, 'push', wrappedpush)
421 421 > EOF
422 422
423 423 $ cat >> .hg/hgrc << EOF
424 424 > [paths]
425 425 > default-push = ssh://user@dummy/remote
426 426 > [ui]
427 > ssh = python "$TESTDIR/dummyssh"
427 > ssh = dummyssh
428 428 > [extensions]
429 429 > localwrite = localwrite.py
430 430 > EOF
431 431
432 432 $ echo localwrite > foo
433 433 $ hg commit -m 'testing localwrite'
434 434 $ hg push
435 435 pushing to ssh://user@dummy/remote
436 436 searching for changes
437 437 remote: adding changesets
438 438 remote: adding manifests
439 439 remote: adding file changes
440 440 remote: added 1 changesets with 1 changes to 1 files
441 441 remote: KABOOM
442 442 local stdout
443 443
444 444 debug output
445 445
446 446 $ hg pull --debug ssh://user@dummy/remote
447 447 pulling from ssh://user@dummy/remote
448 running python "*/dummyssh" user@dummy 'hg -R remote serve --stdio' (glob)
448 running dummyssh user@dummy 'hg -R remote serve --stdio'
449 449 sending hello command
450 450 sending between command
451 451 remote: 286
452 452 remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch stream bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024
453 453 remote: 1
454 454 query 1; heads
455 455 sending batch command
456 456 searching for changes
457 457 all remote heads known locally
458 458 no changes found
459 459 sending getbundle command
460 460 bundle2-input-bundle: with-transaction
461 461 bundle2-input-part: "listkeys" (params: 1 mandatory) supported
462 462 bundle2-input-part: "listkeys" (params: 1 mandatory) supported
463 463 bundle2-input-part: total payload size 45
464 464 bundle2-input-bundle: 1 parts total
465 465 checking for updated bookmarks
466 466 preparing listkeys for "phases"
467 467 sending listkeys command
468 468 received listkey for "phases": 15 bytes
469 469
470 470 $ cd ..
471 471
472 472 $ cat dummylog
473 473 Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio
474 474 Got arguments 1:user@dummy 2:hg -R /$TESTTMP/nonexistent serve --stdio
475 475 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
476 476 Got arguments 1:user@dummy 2:hg -R local-stream serve --stdio
477 477 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
478 478 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
479 479 Got arguments 1:user@dummy 2:hg -R doesnotexist serve --stdio
480 480 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
481 481 Got arguments 1:user@dummy 2:hg -R local serve --stdio
482 482 Got arguments 1:user@dummy 2:hg -R $TESTTMP/local serve --stdio
483 483 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
484 484 changegroup-in-remote hook: HG_BUNDLE2=1 HG_NODE=a28a9d1a809cab7d4e2fde4bee738a9ede948b60 HG_SOURCE=serve HG_TXNID=TXN:* HG_URL=remote:ssh:127.0.0.1 (glob)
485 485 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
486 486 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
487 487 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
488 488 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
489 489 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
490 490 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
491 491 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
492 492 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
493 493 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
494 494 changegroup-in-remote hook: HG_BUNDLE2=1 HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6 HG_SOURCE=serve HG_TXNID=TXN:* HG_URL=remote:ssh:127.0.0.1 (glob)
495 495 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
496 496 Got arguments 1:user@dummy 2:hg init 'a repo'
497 497 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
498 498 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
499 499 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
500 500 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
501 501 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
502 502 changegroup-in-remote hook: HG_BUNDLE2=1 HG_NODE=65c38f4125f9602c8db4af56530cc221d93b8ef8 HG_SOURCE=serve HG_TXNID=TXN:* HG_URL=remote:ssh:127.0.0.1 (glob)
503 503 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
@@ -1,105 +1,105 b''
1 1 #require killdaemons
2 2
3 3 Preparing the subrepository 'sub'
4 4
5 5 $ hg init sub
6 6 $ echo sub > sub/sub
7 7 $ hg add -R sub
8 8 adding sub/sub (glob)
9 9 $ hg commit -R sub -m "sub import"
10 10
11 11 Preparing the 'main' repo which depends on the subrepo 'sub'
12 12
13 13 $ hg init main
14 14 $ echo main > main/main
15 15 $ echo "sub = ../sub" > main/.hgsub
16 16 $ hg clone sub main/sub
17 17 updating to branch default
18 18 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
19 19 $ hg add -R main
20 20 adding main/.hgsub (glob)
21 21 adding main/main (glob)
22 22 $ hg commit -R main -m "main import"
23 23
24 24 Cleaning both repositories, just as a clone -U
25 25
26 26 $ hg up -C -R sub null
27 27 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
28 28 $ hg up -C -R main null
29 29 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
30 30 $ rm -rf main/sub
31 31
32 32 hide outer repo
33 33 $ hg init
34 34
35 35 Serving them both using hgweb
36 36
37 37 $ printf '[paths]\n/main = main\nsub = sub\n' > webdir.conf
38 38 $ hg serve --webdir-conf webdir.conf -a localhost -p $HGPORT \
39 39 > -A /dev/null -E /dev/null --pid-file hg.pid -d
40 40 $ cat hg.pid >> $DAEMON_PIDS
41 41
42 42 Clone main from hgweb
43 43
44 44 $ hg clone "http://localhost:$HGPORT/main" cloned
45 45 requesting all changes
46 46 adding changesets
47 47 adding manifests
48 48 adding file changes
49 49 added 1 changesets with 3 changes to 3 files
50 50 updating to branch default
51 51 cloning subrepo sub from http://localhost:$HGPORT/sub
52 52 requesting all changes
53 53 adding changesets
54 54 adding manifests
55 55 adding file changes
56 56 added 1 changesets with 1 changes to 1 files
57 57 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
58 58
59 59 Checking cloned repo ids
60 60
61 61 $ hg id -R cloned
62 62 fdfeeb3e979e tip
63 63 $ hg id -R cloned/sub
64 64 863c1745b441 tip
65 65
66 66 subrepo debug for 'main' clone
67 67
68 68 $ hg debugsub -R cloned
69 69 path sub
70 70 source ../sub
71 71 revision 863c1745b441bd97a8c4a096e87793073f4fb215
72 72
73 73 $ killdaemons.py
74 74
75 75 subrepo paths with ssh urls
76 76
77 $ hg clone -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/cloned sshclone
77 $ hg clone -e dummyssh ssh://user@dummy/cloned sshclone
78 78 requesting all changes
79 79 adding changesets
80 80 adding manifests
81 81 adding file changes
82 82 added 1 changesets with 3 changes to 3 files
83 83 updating to branch default
84 84 cloning subrepo sub from ssh://user@dummy/sub
85 85 requesting all changes
86 86 adding changesets
87 87 adding manifests
88 88 adding file changes
89 89 added 1 changesets with 1 changes to 1 files
90 90 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
91 91
92 $ hg -R sshclone push -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/`pwd`/cloned
92 $ hg -R sshclone push -e dummyssh ssh://user@dummy/`pwd`/cloned
93 93 pushing to ssh://user@dummy/$TESTTMP/cloned
94 94 pushing subrepo sub to ssh://user@dummy/$TESTTMP/sub
95 95 searching for changes
96 96 no changes found
97 97 searching for changes
98 98 no changes found
99 99 [1]
100 100
101 101 $ cat dummylog
102 102 Got arguments 1:user@dummy 2:hg -R cloned serve --stdio
103 103 Got arguments 1:user@dummy 2:hg -R sub serve --stdio
104 104 Got arguments 1:user@dummy 2:hg -R $TESTTMP/cloned serve --stdio
105 105 Got arguments 1:user@dummy 2:hg -R $TESTTMP/sub serve --stdio
General Comments 0
You need to be logged in to leave comments. Login now