##// END OF EJS Templates
test-bookmarks-pushpull: add failing test of issue4700...
Valentin Gatien-Baron -
r41055:c236a491 default
parent child Browse files
Show More
@@ -1,1277 +1,1323 b''
1 1 #testcases b2-pushkey b2-binary
2 2
3 3 #if b2-pushkey
4 4 $ cat << EOF >> $HGRCPATH
5 5 > [devel]
6 6 > legacy.exchange=bookmarks
7 7 > EOF
8 8 #endif
9 9
10 10 #require serve
11 11
12 12 $ cat << EOF >> $HGRCPATH
13 13 > [ui]
14 14 > logtemplate={rev}:{node|short} {desc|firstline}
15 15 > [phases]
16 16 > publish=False
17 17 > [experimental]
18 18 > evolution.createmarkers=True
19 19 > evolution.exchange=True
20 20 > EOF
21 21
22 22 $ cat > $TESTTMP/hook.sh <<'EOF'
23 23 > echo "test-hook-bookmark: $HG_BOOKMARK: $HG_OLDNODE -> $HG_NODE"
24 24 > EOF
25 25 $ TESTHOOK="hooks.txnclose-bookmark.test=sh $TESTTMP/hook.sh"
26 26
27 27 initialize
28 28
29 29 $ hg init a
30 30 $ cd a
31 31 $ echo 'test' > test
32 32 $ hg commit -Am'test'
33 33 adding test
34 34
35 35 set bookmarks
36 36
37 37 $ hg bookmark X
38 38 $ hg bookmark Y
39 39 $ hg bookmark Z
40 40
41 41 import bookmark by name
42 42
43 43 $ hg init ../b
44 44 $ cd ../b
45 45 $ hg book Y
46 46 $ hg book
47 47 * Y -1:000000000000
48 48 $ hg pull ../a --config "$TESTHOOK"
49 49 pulling from ../a
50 50 requesting all changes
51 51 adding changesets
52 52 adding manifests
53 53 adding file changes
54 54 added 1 changesets with 1 changes to 1 files
55 55 adding remote bookmark X
56 56 updating bookmark Y
57 57 adding remote bookmark Z
58 58 new changesets 4e3505fd9583 (1 drafts)
59 59 test-hook-bookmark: X: -> 4e3505fd95835d721066b76e75dbb8cc554d7f77
60 60 test-hook-bookmark: Y: 0000000000000000000000000000000000000000 -> 4e3505fd95835d721066b76e75dbb8cc554d7f77
61 61 test-hook-bookmark: Z: -> 4e3505fd95835d721066b76e75dbb8cc554d7f77
62 62 (run 'hg update' to get a working copy)
63 63 $ hg bookmarks
64 64 X 0:4e3505fd9583
65 65 * Y 0:4e3505fd9583
66 66 Z 0:4e3505fd9583
67 67 $ hg debugpushkey ../a namespaces
68 68 bookmarks
69 69 namespaces
70 70 obsolete
71 71 phases
72 72 $ hg debugpushkey ../a bookmarks
73 73 X 4e3505fd95835d721066b76e75dbb8cc554d7f77
74 74 Y 4e3505fd95835d721066b76e75dbb8cc554d7f77
75 75 Z 4e3505fd95835d721066b76e75dbb8cc554d7f77
76 76
77 77 delete the bookmark to re-pull it
78 78
79 79 $ hg book -d X
80 80 $ hg pull -B X ../a
81 81 pulling from ../a
82 82 no changes found
83 83 adding remote bookmark X
84 84
85 85 finally no-op pull
86 86
87 87 $ hg pull -B X ../a
88 88 pulling from ../a
89 89 no changes found
90 90 $ hg bookmark
91 91 X 0:4e3505fd9583
92 92 * Y 0:4e3505fd9583
93 93 Z 0:4e3505fd9583
94 94
95 95 export bookmark by name
96 96
97 97 $ hg bookmark W
98 98 $ hg bookmark foo
99 99 $ hg bookmark foobar
100 100 $ hg push -B W ../a
101 101 pushing to ../a
102 102 searching for changes
103 103 no changes found
104 104 exporting bookmark W
105 105 [1]
106 106 $ hg -R ../a bookmarks
107 107 W -1:000000000000
108 108 X 0:4e3505fd9583
109 109 Y 0:4e3505fd9583
110 110 * Z 0:4e3505fd9583
111 111
112 112 delete a remote bookmark
113 113
114 114 $ hg book -d W
115 115
116 116 #if b2-pushkey
117 117
118 118 $ hg push -B W ../a --config "$TESTHOOK" --debug --config devel.bundle2.debug=yes
119 119 pushing to ../a
120 120 query 1; heads
121 121 searching for changes
122 122 all remote heads known locally
123 123 listing keys for "phases"
124 124 checking for updated bookmarks
125 125 listing keys for "bookmarks"
126 126 no changes found
127 127 bundle2-output-bundle: "HG20", 4 parts total
128 128 bundle2-output: start emission of HG20 stream
129 129 bundle2-output: bundle parameter:
130 130 bundle2-output: start of parts
131 131 bundle2-output: bundle part: "replycaps"
132 132 bundle2-output-part: "replycaps" 222 bytes payload
133 133 bundle2-output: part 0: "REPLYCAPS"
134 134 bundle2-output: header chunk size: 16
135 135 bundle2-output: payload chunk size: 222
136 136 bundle2-output: closing payload chunk
137 137 bundle2-output: bundle part: "check:bookmarks"
138 138 bundle2-output-part: "check:bookmarks" 23 bytes payload
139 139 bundle2-output: part 1: "CHECK:BOOKMARKS"
140 140 bundle2-output: header chunk size: 22
141 141 bundle2-output: payload chunk size: 23
142 142 bundle2-output: closing payload chunk
143 143 bundle2-output: bundle part: "check:phases"
144 144 bundle2-output-part: "check:phases" 24 bytes payload
145 145 bundle2-output: part 2: "CHECK:PHASES"
146 146 bundle2-output: header chunk size: 19
147 147 bundle2-output: payload chunk size: 24
148 148 bundle2-output: closing payload chunk
149 149 bundle2-output: bundle part: "pushkey"
150 150 bundle2-output-part: "pushkey" (params: 4 mandatory) empty payload
151 151 bundle2-output: part 3: "PUSHKEY"
152 152 bundle2-output: header chunk size: 90
153 153 bundle2-output: closing payload chunk
154 154 bundle2-output: end of bundle
155 155 bundle2-input: start processing of HG20 stream
156 156 bundle2-input: reading bundle2 stream parameters
157 157 bundle2-input-bundle: with-transaction
158 158 bundle2-input: start extraction of bundle2 parts
159 159 bundle2-input: part header size: 16
160 160 bundle2-input: part type: "REPLYCAPS"
161 161 bundle2-input: part id: "0"
162 162 bundle2-input: part parameters: 0
163 163 bundle2-input: found a handler for part replycaps
164 164 bundle2-input-part: "replycaps" supported
165 165 bundle2-input: payload chunk size: 222
166 166 bundle2-input: payload chunk size: 0
167 167 bundle2-input-part: total payload size 222
168 168 bundle2-input: part header size: 22
169 169 bundle2-input: part type: "CHECK:BOOKMARKS"
170 170 bundle2-input: part id: "1"
171 171 bundle2-input: part parameters: 0
172 172 bundle2-input: found a handler for part check:bookmarks
173 173 bundle2-input-part: "check:bookmarks" supported
174 174 bundle2-input: payload chunk size: 23
175 175 bundle2-input: payload chunk size: 0
176 176 bundle2-input-part: total payload size 23
177 177 bundle2-input: part header size: 19
178 178 bundle2-input: part type: "CHECK:PHASES"
179 179 bundle2-input: part id: "2"
180 180 bundle2-input: part parameters: 0
181 181 bundle2-input: found a handler for part check:phases
182 182 bundle2-input-part: "check:phases" supported
183 183 bundle2-input: payload chunk size: 24
184 184 bundle2-input: payload chunk size: 0
185 185 bundle2-input-part: total payload size 24
186 186 bundle2-input: part header size: 90
187 187 bundle2-input: part type: "PUSHKEY"
188 188 bundle2-input: part id: "3"
189 189 bundle2-input: part parameters: 4
190 190 bundle2-input: found a handler for part pushkey
191 191 bundle2-input-part: "pushkey" (params: 4 mandatory) supported
192 192 pushing key for "bookmarks:W"
193 193 bundle2-input: payload chunk size: 0
194 194 bundle2-input: part header size: 0
195 195 bundle2-input: end of bundle2 stream
196 196 bundle2-input-bundle: 3 parts total
197 197 running hook txnclose-bookmark.test: sh $TESTTMP/hook.sh
198 198 test-hook-bookmark: W: 0000000000000000000000000000000000000000 ->
199 199 bundle2-output-bundle: "HG20", 1 parts total
200 200 bundle2-output: start emission of HG20 stream
201 201 bundle2-output: bundle parameter:
202 202 bundle2-output: start of parts
203 203 bundle2-output: bundle part: "reply:pushkey"
204 204 bundle2-output-part: "reply:pushkey" (params: 0 advisory) empty payload
205 205 bundle2-output: part 0: "REPLY:PUSHKEY"
206 206 bundle2-output: header chunk size: 43
207 207 bundle2-output: closing payload chunk
208 208 bundle2-output: end of bundle
209 209 bundle2-input: start processing of HG20 stream
210 210 bundle2-input: reading bundle2 stream parameters
211 211 bundle2-input-bundle: no-transaction
212 212 bundle2-input: start extraction of bundle2 parts
213 213 bundle2-input: part header size: 43
214 214 bundle2-input: part type: "REPLY:PUSHKEY"
215 215 bundle2-input: part id: "0"
216 216 bundle2-input: part parameters: 2
217 217 bundle2-input: found a handler for part reply:pushkey
218 218 bundle2-input-part: "reply:pushkey" (params: 0 advisory) supported
219 219 bundle2-input: payload chunk size: 0
220 220 bundle2-input: part header size: 0
221 221 bundle2-input: end of bundle2 stream
222 222 bundle2-input-bundle: 0 parts total
223 223 deleting remote bookmark W
224 224 listing keys for "phases"
225 225 [1]
226 226
227 227 #endif
228 228 #if b2-binary
229 229
230 230 $ hg push -B W ../a --config "$TESTHOOK" --debug --config devel.bundle2.debug=yes
231 231 pushing to ../a
232 232 query 1; heads
233 233 searching for changes
234 234 all remote heads known locally
235 235 listing keys for "phases"
236 236 checking for updated bookmarks
237 237 listing keys for "bookmarks"
238 238 no changes found
239 239 bundle2-output-bundle: "HG20", 4 parts total
240 240 bundle2-output: start emission of HG20 stream
241 241 bundle2-output: bundle parameter:
242 242 bundle2-output: start of parts
243 243 bundle2-output: bundle part: "replycaps"
244 244 bundle2-output-part: "replycaps" 222 bytes payload
245 245 bundle2-output: part 0: "REPLYCAPS"
246 246 bundle2-output: header chunk size: 16
247 247 bundle2-output: payload chunk size: 222
248 248 bundle2-output: closing payload chunk
249 249 bundle2-output: bundle part: "check:bookmarks"
250 250 bundle2-output-part: "check:bookmarks" 23 bytes payload
251 251 bundle2-output: part 1: "CHECK:BOOKMARKS"
252 252 bundle2-output: header chunk size: 22
253 253 bundle2-output: payload chunk size: 23
254 254 bundle2-output: closing payload chunk
255 255 bundle2-output: bundle part: "check:phases"
256 256 bundle2-output-part: "check:phases" 24 bytes payload
257 257 bundle2-output: part 2: "CHECK:PHASES"
258 258 bundle2-output: header chunk size: 19
259 259 bundle2-output: payload chunk size: 24
260 260 bundle2-output: closing payload chunk
261 261 bundle2-output: bundle part: "bookmarks"
262 262 bundle2-output-part: "bookmarks" 23 bytes payload
263 263 bundle2-output: part 3: "BOOKMARKS"
264 264 bundle2-output: header chunk size: 16
265 265 bundle2-output: payload chunk size: 23
266 266 bundle2-output: closing payload chunk
267 267 bundle2-output: end of bundle
268 268 bundle2-input: start processing of HG20 stream
269 269 bundle2-input: reading bundle2 stream parameters
270 270 bundle2-input-bundle: with-transaction
271 271 bundle2-input: start extraction of bundle2 parts
272 272 bundle2-input: part header size: 16
273 273 bundle2-input: part type: "REPLYCAPS"
274 274 bundle2-input: part id: "0"
275 275 bundle2-input: part parameters: 0
276 276 bundle2-input: found a handler for part replycaps
277 277 bundle2-input-part: "replycaps" supported
278 278 bundle2-input: payload chunk size: 222
279 279 bundle2-input: payload chunk size: 0
280 280 bundle2-input-part: total payload size 222
281 281 bundle2-input: part header size: 22
282 282 bundle2-input: part type: "CHECK:BOOKMARKS"
283 283 bundle2-input: part id: "1"
284 284 bundle2-input: part parameters: 0
285 285 bundle2-input: found a handler for part check:bookmarks
286 286 bundle2-input-part: "check:bookmarks" supported
287 287 bundle2-input: payload chunk size: 23
288 288 bundle2-input: payload chunk size: 0
289 289 bundle2-input-part: total payload size 23
290 290 bundle2-input: part header size: 19
291 291 bundle2-input: part type: "CHECK:PHASES"
292 292 bundle2-input: part id: "2"
293 293 bundle2-input: part parameters: 0
294 294 bundle2-input: found a handler for part check:phases
295 295 bundle2-input-part: "check:phases" supported
296 296 bundle2-input: payload chunk size: 24
297 297 bundle2-input: payload chunk size: 0
298 298 bundle2-input-part: total payload size 24
299 299 bundle2-input: part header size: 16
300 300 bundle2-input: part type: "BOOKMARKS"
301 301 bundle2-input: part id: "3"
302 302 bundle2-input: part parameters: 0
303 303 bundle2-input: found a handler for part bookmarks
304 304 bundle2-input-part: "bookmarks" supported
305 305 bundle2-input: payload chunk size: 23
306 306 bundle2-input: payload chunk size: 0
307 307 bundle2-input-part: total payload size 23
308 308 bundle2-input: part header size: 0
309 309 bundle2-input: end of bundle2 stream
310 310 bundle2-input-bundle: 3 parts total
311 311 running hook txnclose-bookmark.test: sh $TESTTMP/hook.sh
312 312 test-hook-bookmark: W: 0000000000000000000000000000000000000000 ->
313 313 bundle2-output-bundle: "HG20", 0 parts total
314 314 bundle2-output: start emission of HG20 stream
315 315 bundle2-output: bundle parameter:
316 316 bundle2-output: start of parts
317 317 bundle2-output: end of bundle
318 318 bundle2-input: start processing of HG20 stream
319 319 bundle2-input: reading bundle2 stream parameters
320 320 bundle2-input-bundle: no-transaction
321 321 bundle2-input: start extraction of bundle2 parts
322 322 bundle2-input: part header size: 0
323 323 bundle2-input: end of bundle2 stream
324 324 bundle2-input-bundle: 0 parts total
325 325 deleting remote bookmark W
326 326 listing keys for "phases"
327 327 [1]
328 328
329 329 #endif
330 330
331 331 export the active bookmark
332 332
333 333 $ hg bookmark V
334 334 $ hg push -B . ../a
335 335 pushing to ../a
336 336 searching for changes
337 337 no changes found
338 338 exporting bookmark V
339 339 [1]
340 340
341 341 exporting the active bookmark with 'push -B .'
342 342 demand that one of the bookmarks is activated
343 343
344 344 $ hg update -r default
345 345 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
346 346 (leaving bookmark V)
347 347 $ hg push -B . ../a
348 348 abort: no active bookmark!
349 349 [255]
350 350 $ hg update -r V
351 351 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
352 352 (activating bookmark V)
353 353
354 354 delete the bookmark
355 355
356 356 $ hg book -d V
357 357 $ hg push -B V ../a
358 358 pushing to ../a
359 359 searching for changes
360 360 no changes found
361 361 deleting remote bookmark V
362 362 [1]
363 363 $ hg up foobar
364 364 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
365 365 (activating bookmark foobar)
366 366
367 367 push/pull name that doesn't exist
368 368
369 369 $ hg push -B badname ../a
370 370 pushing to ../a
371 371 searching for changes
372 372 bookmark badname does not exist on the local or remote repository!
373 373 no changes found
374 374 [2]
375 375 $ hg pull -B anotherbadname ../a
376 376 pulling from ../a
377 377 abort: remote bookmark anotherbadname not found!
378 378 [255]
379 379
380 380 divergent bookmarks
381 381
382 382 $ cd ../a
383 383 $ echo c1 > f1
384 384 $ hg ci -Am1
385 385 adding f1
386 386 $ hg book -f @
387 387 $ hg book -f X
388 388 $ hg book
389 389 @ 1:0d2164f0ce0d
390 390 * X 1:0d2164f0ce0d
391 391 Y 0:4e3505fd9583
392 392 Z 1:0d2164f0ce0d
393 393
394 394 $ cd ../b
395 395 $ hg up
396 396 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
397 397 updating bookmark foobar
398 398 $ echo c2 > f2
399 399 $ hg ci -Am2
400 400 adding f2
401 401 $ hg book -if @
402 402 $ hg book -if X
403 403 $ hg book
404 404 @ 1:9b140be10808
405 405 X 1:9b140be10808
406 406 Y 0:4e3505fd9583
407 407 Z 0:4e3505fd9583
408 408 foo -1:000000000000
409 409 * foobar 1:9b140be10808
410 410
411 411 $ hg pull --config paths.foo=../a foo --config "$TESTHOOK"
412 412 pulling from $TESTTMP/a
413 413 searching for changes
414 414 adding changesets
415 415 adding manifests
416 416 adding file changes
417 417 added 1 changesets with 1 changes to 1 files (+1 heads)
418 418 divergent bookmark @ stored as @foo
419 419 divergent bookmark X stored as X@foo
420 420 updating bookmark Z
421 421 new changesets 0d2164f0ce0d (1 drafts)
422 422 test-hook-bookmark: @foo: -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
423 423 test-hook-bookmark: X@foo: -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
424 424 test-hook-bookmark: Z: 4e3505fd95835d721066b76e75dbb8cc554d7f77 -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
425 425 (run 'hg heads' to see heads, 'hg merge' to merge)
426 426 $ hg book
427 427 @ 1:9b140be10808
428 428 @foo 2:0d2164f0ce0d
429 429 X 1:9b140be10808
430 430 X@foo 2:0d2164f0ce0d
431 431 Y 0:4e3505fd9583
432 432 Z 2:0d2164f0ce0d
433 433 foo -1:000000000000
434 434 * foobar 1:9b140be10808
435 435
436 436 (test that too many divergence of bookmark)
437 437
438 438 $ "$PYTHON" $TESTDIR/seq.py 1 100 | while read i; do hg bookmarks -r 000000000000 "X@${i}"; done
439 439 $ hg pull ../a
440 440 pulling from ../a
441 441 searching for changes
442 442 no changes found
443 443 warning: failed to assign numbered name to divergent bookmark X
444 444 divergent bookmark @ stored as @1
445 445 $ hg bookmarks | grep '^ X' | grep -v ':000000000000'
446 446 X 1:9b140be10808
447 447 X@foo 2:0d2164f0ce0d
448 448
449 449 (test that remotely diverged bookmarks are reused if they aren't changed)
450 450
451 451 $ hg bookmarks | grep '^ @'
452 452 @ 1:9b140be10808
453 453 @1 2:0d2164f0ce0d
454 454 @foo 2:0d2164f0ce0d
455 455 $ hg pull ../a
456 456 pulling from ../a
457 457 searching for changes
458 458 no changes found
459 459 warning: failed to assign numbered name to divergent bookmark X
460 460 divergent bookmark @ stored as @1
461 461 $ hg bookmarks | grep '^ @'
462 462 @ 1:9b140be10808
463 463 @1 2:0d2164f0ce0d
464 464 @foo 2:0d2164f0ce0d
465 465
466 466 $ "$PYTHON" $TESTDIR/seq.py 1 100 | while read i; do hg bookmarks -d "X@${i}"; done
467 467 $ hg bookmarks -d "@1"
468 468
469 469 $ hg push -f ../a
470 470 pushing to ../a
471 471 searching for changes
472 472 adding changesets
473 473 adding manifests
474 474 adding file changes
475 475 added 1 changesets with 1 changes to 1 files (+1 heads)
476 476 $ hg -R ../a book
477 477 @ 1:0d2164f0ce0d
478 478 * X 1:0d2164f0ce0d
479 479 Y 0:4e3505fd9583
480 480 Z 1:0d2164f0ce0d
481 481
482 482 explicit pull should overwrite the local version (issue4439)
483 483
484 484 $ hg update -r X
485 485 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
486 486 (activating bookmark X)
487 487 $ hg pull --config paths.foo=../a foo -B . --config "$TESTHOOK"
488 488 pulling from $TESTTMP/a
489 489 no changes found
490 490 divergent bookmark @ stored as @foo
491 491 importing bookmark X
492 492 test-hook-bookmark: @foo: 0d2164f0ce0d8f1d6f94351eba04b794909be66c -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
493 493 test-hook-bookmark: X: 9b140be1080824d768c5a4691a564088eede71f9 -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
494 494
495 495 reinstall state for further testing:
496 496
497 497 $ hg book -fr 9b140be10808 X
498 498
499 499 revsets should not ignore divergent bookmarks
500 500
501 501 $ hg bookmark -fr 1 Z
502 502 $ hg log -r 'bookmark()' --template '{rev}:{node|short} {bookmarks}\n'
503 503 0:4e3505fd9583 Y
504 504 1:9b140be10808 @ X Z foobar
505 505 2:0d2164f0ce0d @foo X@foo
506 506 $ hg log -r 'bookmark("X@foo")' --template '{rev}:{node|short} {bookmarks}\n'
507 507 2:0d2164f0ce0d @foo X@foo
508 508 $ hg log -r 'bookmark("re:X@foo")' --template '{rev}:{node|short} {bookmarks}\n'
509 509 2:0d2164f0ce0d @foo X@foo
510 510
511 511 update a remote bookmark from a non-head to a head
512 512
513 513 $ hg up -q Y
514 514 $ echo c3 > f2
515 515 $ hg ci -Am3
516 516 adding f2
517 517 created new head
518 518 $ hg push ../a --config "$TESTHOOK"
519 519 pushing to ../a
520 520 searching for changes
521 521 adding changesets
522 522 adding manifests
523 523 adding file changes
524 524 added 1 changesets with 1 changes to 1 files (+1 heads)
525 525 test-hook-bookmark: Y: 4e3505fd95835d721066b76e75dbb8cc554d7f77 -> f6fc62dde3c0771e29704af56ba4d8af77abcc2f
526 526 updating bookmark Y
527 527 $ hg -R ../a book
528 528 @ 1:0d2164f0ce0d
529 529 * X 1:0d2164f0ce0d
530 530 Y 3:f6fc62dde3c0
531 531 Z 1:0d2164f0ce0d
532 532
533 533 update a bookmark in the middle of a client pulling changes
534 534
535 535 $ cd ..
536 536 $ hg clone -q a pull-race
537 537
538 538 We want to use http because it is stateless and therefore more susceptible to
539 539 race conditions
540 540
541 541 $ hg serve -R pull-race -p $HGPORT -d --pid-file=pull-race.pid -E main-error.log
542 542 $ cat pull-race.pid >> $DAEMON_PIDS
543 543
544 544 $ cat <<EOF > $TESTTMP/out_makecommit.sh
545 545 > #!/bin/sh
546 546 > hg ci -Am5
547 547 > echo committed in pull-race
548 548 > EOF
549 549
550 550 $ hg clone -q http://localhost:$HGPORT/ pull-race2 --config "$TESTHOOK"
551 551 test-hook-bookmark: @: -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
552 552 test-hook-bookmark: X: -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
553 553 test-hook-bookmark: Y: -> f6fc62dde3c0771e29704af56ba4d8af77abcc2f
554 554 test-hook-bookmark: Z: -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
555 555 $ cd pull-race
556 556 $ hg up -q Y
557 557 $ echo c4 > f2
558 558 $ hg ci -Am4
559 559 $ echo c5 > f3
560 560 $ cat <<EOF > .hg/hgrc
561 561 > [hooks]
562 562 > outgoing.makecommit = sh $TESTTMP/out_makecommit.sh
563 563 > EOF
564 564
565 565 (new config needs a server restart)
566 566
567 567 $ cd ..
568 568 $ killdaemons.py
569 569 $ hg serve -R pull-race -p $HGPORT -d --pid-file=pull-race.pid -E main-error.log
570 570 $ cat pull-race.pid >> $DAEMON_PIDS
571 571 $ cd pull-race2
572 572 $ hg -R $TESTTMP/pull-race book
573 573 @ 1:0d2164f0ce0d
574 574 X 1:0d2164f0ce0d
575 575 * Y 4:b0a5eff05604
576 576 Z 1:0d2164f0ce0d
577 577 $ hg pull
578 578 pulling from http://localhost:$HGPORT/
579 579 searching for changes
580 580 adding changesets
581 581 adding manifests
582 582 adding file changes
583 583 added 1 changesets with 1 changes to 1 files
584 584 updating bookmark Y
585 585 new changesets b0a5eff05604 (1 drafts)
586 586 (run 'hg update' to get a working copy)
587 587 $ hg book
588 588 * @ 1:0d2164f0ce0d
589 589 X 1:0d2164f0ce0d
590 590 Y 4:b0a5eff05604
591 591 Z 1:0d2164f0ce0d
592 592
593 593 Update a bookmark right after the initial lookup -B (issue4689)
594 594
595 595 $ echo c6 > ../pull-race/f3 # to be committed during the race
596 596 $ cat <<EOF > $TESTTMP/listkeys_makecommit.sh
597 597 > #!/bin/sh
598 598 > if hg st | grep -q M; then
599 599 > hg commit -m race
600 600 > echo committed in pull-race
601 601 > else
602 602 > exit 0
603 603 > fi
604 604 > EOF
605 605 $ cat <<EOF > ../pull-race/.hg/hgrc
606 606 > [hooks]
607 607 > # If anything to commit, commit it right after the first key listing used
608 608 > # during lookup. This makes the commit appear before the actual getbundle
609 609 > # call.
610 610 > listkeys.makecommit= sh $TESTTMP/listkeys_makecommit.sh
611 611 > EOF
612
613 (new config need server restart)
614
615 $ killdaemons.py
616 $ hg serve -R ../pull-race -p $HGPORT -d --pid-file=../pull-race.pid -E main-error.log
617 $ cat ../pull-race.pid >> $DAEMON_PIDS
618
612 $ restart_server() {
613 > "$TESTDIR/killdaemons.py" $DAEMON_PIDS
614 > hg serve -R ../pull-race -p $HGPORT -d --pid-file=../pull-race.pid -E main-error.log
615 > cat ../pull-race.pid >> $DAEMON_PIDS
616 > }
617 $ restart_server # new config need server restart
619 618 $ hg -R $TESTTMP/pull-race book
620 619 @ 1:0d2164f0ce0d
621 620 X 1:0d2164f0ce0d
622 621 * Y 5:35d1ef0a8d1b
623 622 Z 1:0d2164f0ce0d
624 623 $ hg update -r Y
625 624 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
626 625 (activating bookmark Y)
627 626 $ hg pull -B .
628 627 pulling from http://localhost:$HGPORT/
629 628 searching for changes
630 629 adding changesets
631 630 adding manifests
632 631 adding file changes
633 632 added 1 changesets with 1 changes to 1 files
634 633 updating bookmark Y
635 634 new changesets 35d1ef0a8d1b (1 drafts)
636 635 (run 'hg update' to get a working copy)
637 636 $ hg book
638 637 @ 1:0d2164f0ce0d
639 638 X 1:0d2164f0ce0d
640 639 * Y 5:35d1ef0a8d1b
641 640 Z 1:0d2164f0ce0d
642 641
642 Update a bookmark right after the initial lookup -r (issue4700)
643
644 $ echo c7 > ../pull-race/f3 # to be committed during the race
645 $ cat <<EOF > ../lookuphook.py
646 > """small extensions adding a hook after wireprotocol lookup to test race"""
647 > import functools
648 > from mercurial import wireprotov1server, wireprotov2server
649 >
650 > def wrappedlookup(orig, repo, *args, **kwargs):
651 > ret = orig(repo, *args, **kwargs)
652 > repo.hook(b'lookup')
653 > return ret
654 > for table in [wireprotov1server.commands, wireprotov2server.COMMANDS]:
655 > table[b'lookup'].func = functools.partial(wrappedlookup, table[b'lookup'].func)
656 > EOF
657 $ cat <<EOF > ../pull-race/.hg/hgrc
658 > [extensions]
659 > lookuphook=$TESTTMP/lookuphook.py
660 > [hooks]
661 > lookup.makecommit= sh $TESTTMP/listkeys_makecommit.sh
662 > EOF
663 $ restart_server # new config need server restart
664 $ hg -R $TESTTMP/pull-race book
665 @ 1:0d2164f0ce0d
666 X 1:0d2164f0ce0d
667 * Y 6:0d60821d2197
668 Z 1:0d2164f0ce0d
669 $ hg pull -r Y
670 pulling from http://localhost:$HGPORT/
671 searching for changes
672 adding changesets
673 adding manifests
674 adding file changes
675 added 1 changesets with 1 changes to 1 files
676 new changesets 0d60821d2197 (1 drafts)
677 (run 'hg update' to get a working copy)
678 $ hg book
679 @ 1:0d2164f0ce0d
680 X 1:0d2164f0ce0d
681 * Y 5:35d1ef0a8d1b
682 Z 1:0d2164f0ce0d
683 $ hg -R $TESTTMP/pull-race book
684 @ 1:0d2164f0ce0d
685 X 1:0d2164f0ce0d
686 * Y 7:714424d9e8b8
687 Z 1:0d2164f0ce0d
688
643 689 (done with this section of the test)
644 690
645 691 $ killdaemons.py
646 692 $ cd ../b
647 693
648 694 diverging a remote bookmark fails
649 695
650 696 $ hg up -q 4e3505fd9583
651 697 $ echo c4 > f2
652 698 $ hg ci -Am4
653 699 adding f2
654 700 created new head
655 701 $ echo c5 > f2
656 702 $ hg ci -Am5
657 703 $ hg log -G
658 704 @ 5:c922c0139ca0 5
659 705 |
660 706 o 4:4efff6d98829 4
661 707 |
662 708 | o 3:f6fc62dde3c0 3
663 709 |/
664 710 | o 2:0d2164f0ce0d 1
665 711 |/
666 712 | o 1:9b140be10808 2
667 713 |/
668 714 o 0:4e3505fd9583 test
669 715
670 716
671 717 $ hg book -f Y
672 718
673 719 $ cat <<EOF > ../a/.hg/hgrc
674 720 > [web]
675 721 > push_ssl = false
676 722 > allow_push = *
677 723 > EOF
678 724
679 725 $ hg serve -R ../a -p $HGPORT2 -d --pid-file=../hg2.pid
680 726 $ cat ../hg2.pid >> $DAEMON_PIDS
681 727
682 728 $ hg push http://localhost:$HGPORT2/
683 729 pushing to http://localhost:$HGPORT2/
684 730 searching for changes
685 731 abort: push creates new remote head c922c0139ca0 with bookmark 'Y'!
686 732 (merge or see 'hg help push' for details about pushing new heads)
687 733 [255]
688 734 $ hg -R ../a book
689 735 @ 1:0d2164f0ce0d
690 736 * X 1:0d2164f0ce0d
691 737 Y 3:f6fc62dde3c0
692 738 Z 1:0d2164f0ce0d
693 739
694 740
695 741 Unrelated marker does not alter the decision
696 742
697 743 $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
698 744 $ hg push http://localhost:$HGPORT2/
699 745 pushing to http://localhost:$HGPORT2/
700 746 searching for changes
701 747 abort: push creates new remote head c922c0139ca0 with bookmark 'Y'!
702 748 (merge or see 'hg help push' for details about pushing new heads)
703 749 [255]
704 750 $ hg -R ../a book
705 751 @ 1:0d2164f0ce0d
706 752 * X 1:0d2164f0ce0d
707 753 Y 3:f6fc62dde3c0
708 754 Z 1:0d2164f0ce0d
709 755
710 756 Update to a successor works
711 757
712 758 $ hg id --debug -r 3
713 759 f6fc62dde3c0771e29704af56ba4d8af77abcc2f
714 760 $ hg id --debug -r 4
715 761 4efff6d98829d9c824c621afd6e3f01865f5439f
716 762 $ hg id --debug -r 5
717 763 c922c0139ca03858f655e4a2af4dd02796a63969 tip Y
718 764 $ hg debugobsolete f6fc62dde3c0771e29704af56ba4d8af77abcc2f cccccccccccccccccccccccccccccccccccccccc
719 765 obsoleted 1 changesets
720 766 $ hg debugobsolete cccccccccccccccccccccccccccccccccccccccc 4efff6d98829d9c824c621afd6e3f01865f5439f
721 767 $ hg push http://localhost:$HGPORT2/
722 768 pushing to http://localhost:$HGPORT2/
723 769 searching for changes
724 770 remote: adding changesets
725 771 remote: adding manifests
726 772 remote: adding file changes
727 773 remote: added 2 changesets with 2 changes to 1 files (+1 heads)
728 774 remote: 2 new obsolescence markers
729 775 remote: obsoleted 1 changesets
730 776 updating bookmark Y
731 777 $ hg -R ../a book
732 778 @ 1:0d2164f0ce0d
733 779 * X 1:0d2164f0ce0d
734 780 Y 5:c922c0139ca0
735 781 Z 1:0d2164f0ce0d
736 782
737 783 hgweb
738 784
739 785 $ cat <<EOF > .hg/hgrc
740 786 > [web]
741 787 > push_ssl = false
742 788 > allow_push = *
743 789 > EOF
744 790
745 791 $ hg serve -p $HGPORT -d --pid-file=../hg.pid -E errors.log
746 792 $ cat ../hg.pid >> $DAEMON_PIDS
747 793 $ cd ../a
748 794
749 795 $ hg debugpushkey http://localhost:$HGPORT/ namespaces
750 796 bookmarks
751 797 namespaces
752 798 obsolete
753 799 phases
754 800 $ hg debugpushkey http://localhost:$HGPORT/ bookmarks
755 801 @ 9b140be1080824d768c5a4691a564088eede71f9
756 802 X 9b140be1080824d768c5a4691a564088eede71f9
757 803 Y c922c0139ca03858f655e4a2af4dd02796a63969
758 804 Z 9b140be1080824d768c5a4691a564088eede71f9
759 805 foo 0000000000000000000000000000000000000000
760 806 foobar 9b140be1080824d768c5a4691a564088eede71f9
761 807 $ hg out -B http://localhost:$HGPORT/
762 808 comparing with http://localhost:$HGPORT/
763 809 searching for changed bookmarks
764 810 @ 0d2164f0ce0d
765 811 X 0d2164f0ce0d
766 812 Z 0d2164f0ce0d
767 813 foo
768 814 foobar
769 815 $ hg push -B Z http://localhost:$HGPORT/
770 816 pushing to http://localhost:$HGPORT/
771 817 searching for changes
772 818 no changes found
773 819 updating bookmark Z
774 820 [1]
775 821 $ hg book -d Z
776 822 $ hg in -B http://localhost:$HGPORT/
777 823 comparing with http://localhost:$HGPORT/
778 824 searching for changed bookmarks
779 825 @ 9b140be10808
780 826 X 9b140be10808
781 827 Z 0d2164f0ce0d
782 828 foo 000000000000
783 829 foobar 9b140be10808
784 830 $ hg pull -B Z http://localhost:$HGPORT/
785 831 pulling from http://localhost:$HGPORT/
786 832 no changes found
787 833 divergent bookmark @ stored as @1
788 834 divergent bookmark X stored as X@1
789 835 adding remote bookmark Z
790 836 adding remote bookmark foo
791 837 adding remote bookmark foobar
792 838 $ hg clone http://localhost:$HGPORT/ cloned-bookmarks
793 839 requesting all changes
794 840 adding changesets
795 841 adding manifests
796 842 adding file changes
797 843 added 5 changesets with 5 changes to 3 files (+2 heads)
798 844 2 new obsolescence markers
799 845 new changesets 4e3505fd9583:c922c0139ca0 (5 drafts)
800 846 updating to bookmark @
801 847 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
802 848 $ hg -R cloned-bookmarks bookmarks
803 849 * @ 1:9b140be10808
804 850 X 1:9b140be10808
805 851 Y 4:c922c0139ca0
806 852 Z 2:0d2164f0ce0d
807 853 foo -1:000000000000
808 854 foobar 1:9b140be10808
809 855
810 856 $ cd ..
811 857
812 858 Test to show result of bookmarks comparison
813 859
814 860 $ mkdir bmcomparison
815 861 $ cd bmcomparison
816 862
817 863 $ hg init source
818 864 $ hg -R source debugbuilddag '+2*2*3*4'
819 865 $ hg -R source log -G --template '{rev}:{node|short}'
820 866 o 4:e7bd5218ca15
821 867 |
822 868 | o 3:6100d3090acf
823 869 |/
824 870 | o 2:fa942426a6fd
825 871 |/
826 872 | o 1:66f7d451a68b
827 873 |/
828 874 o 0:1ea73414a91b
829 875
830 876 $ hg -R source bookmarks -r 0 SAME
831 877 $ hg -R source bookmarks -r 0 ADV_ON_REPO1
832 878 $ hg -R source bookmarks -r 0 ADV_ON_REPO2
833 879 $ hg -R source bookmarks -r 0 DIFF_ADV_ON_REPO1
834 880 $ hg -R source bookmarks -r 0 DIFF_ADV_ON_REPO2
835 881 $ hg -R source bookmarks -r 1 DIVERGED
836 882
837 883 $ hg clone -U source repo1
838 884
839 885 (test that incoming/outgoing exit with 1, if there is no bookmark to
840 886 be exchanged)
841 887
842 888 $ hg -R repo1 incoming -B
843 889 comparing with $TESTTMP/bmcomparison/source
844 890 searching for changed bookmarks
845 891 no changed bookmarks found
846 892 [1]
847 893 $ hg -R repo1 outgoing -B
848 894 comparing with $TESTTMP/bmcomparison/source
849 895 searching for changed bookmarks
850 896 no changed bookmarks found
851 897 [1]
852 898
853 899 $ hg -R repo1 bookmarks -f -r 1 ADD_ON_REPO1
854 900 $ hg -R repo1 bookmarks -f -r 2 ADV_ON_REPO1
855 901 $ hg -R repo1 bookmarks -f -r 3 DIFF_ADV_ON_REPO1
856 902 $ hg -R repo1 bookmarks -f -r 3 DIFF_DIVERGED
857 903 $ hg -R repo1 -q --config extensions.mq= strip 4
858 904 $ hg -R repo1 log -G --template '{node|short} ({bookmarks})'
859 905 o 6100d3090acf (DIFF_ADV_ON_REPO1 DIFF_DIVERGED)
860 906 |
861 907 | o fa942426a6fd (ADV_ON_REPO1)
862 908 |/
863 909 | o 66f7d451a68b (ADD_ON_REPO1 DIVERGED)
864 910 |/
865 911 o 1ea73414a91b (ADV_ON_REPO2 DIFF_ADV_ON_REPO2 SAME)
866 912
867 913
868 914 $ hg clone -U source repo2
869 915 $ hg -R repo2 bookmarks -f -r 1 ADD_ON_REPO2
870 916 $ hg -R repo2 bookmarks -f -r 1 ADV_ON_REPO2
871 917 $ hg -R repo2 bookmarks -f -r 2 DIVERGED
872 918 $ hg -R repo2 bookmarks -f -r 4 DIFF_ADV_ON_REPO2
873 919 $ hg -R repo2 bookmarks -f -r 4 DIFF_DIVERGED
874 920 $ hg -R repo2 -q --config extensions.mq= strip 3
875 921 $ hg -R repo2 log -G --template '{node|short} ({bookmarks})'
876 922 o e7bd5218ca15 (DIFF_ADV_ON_REPO2 DIFF_DIVERGED)
877 923 |
878 924 | o fa942426a6fd (DIVERGED)
879 925 |/
880 926 | o 66f7d451a68b (ADD_ON_REPO2 ADV_ON_REPO2)
881 927 |/
882 928 o 1ea73414a91b (ADV_ON_REPO1 DIFF_ADV_ON_REPO1 SAME)
883 929
884 930
885 931 (test that difference of bookmarks between repositories are fully shown)
886 932
887 933 $ hg -R repo1 incoming -B repo2 -v
888 934 comparing with repo2
889 935 searching for changed bookmarks
890 936 ADD_ON_REPO2 66f7d451a68b added
891 937 ADV_ON_REPO2 66f7d451a68b advanced
892 938 DIFF_ADV_ON_REPO2 e7bd5218ca15 changed
893 939 DIFF_DIVERGED e7bd5218ca15 changed
894 940 DIVERGED fa942426a6fd diverged
895 941 $ hg -R repo1 outgoing -B repo2 -v
896 942 comparing with repo2
897 943 searching for changed bookmarks
898 944 ADD_ON_REPO1 66f7d451a68b added
899 945 ADD_ON_REPO2 deleted
900 946 ADV_ON_REPO1 fa942426a6fd advanced
901 947 DIFF_ADV_ON_REPO1 6100d3090acf advanced
902 948 DIFF_ADV_ON_REPO2 1ea73414a91b changed
903 949 DIFF_DIVERGED 6100d3090acf changed
904 950 DIVERGED 66f7d451a68b diverged
905 951
906 952 $ hg -R repo2 incoming -B repo1 -v
907 953 comparing with repo1
908 954 searching for changed bookmarks
909 955 ADD_ON_REPO1 66f7d451a68b added
910 956 ADV_ON_REPO1 fa942426a6fd advanced
911 957 DIFF_ADV_ON_REPO1 6100d3090acf changed
912 958 DIFF_DIVERGED 6100d3090acf changed
913 959 DIVERGED 66f7d451a68b diverged
914 960 $ hg -R repo2 outgoing -B repo1 -v
915 961 comparing with repo1
916 962 searching for changed bookmarks
917 963 ADD_ON_REPO1 deleted
918 964 ADD_ON_REPO2 66f7d451a68b added
919 965 ADV_ON_REPO2 66f7d451a68b advanced
920 966 DIFF_ADV_ON_REPO1 1ea73414a91b changed
921 967 DIFF_ADV_ON_REPO2 e7bd5218ca15 advanced
922 968 DIFF_DIVERGED e7bd5218ca15 changed
923 969 DIVERGED fa942426a6fd diverged
924 970
925 971 $ cd ..
926 972
927 973 Pushing a bookmark should only push the changes required by that
928 974 bookmark, not all outgoing changes:
929 975 $ hg clone http://localhost:$HGPORT/ addmarks
930 976 requesting all changes
931 977 adding changesets
932 978 adding manifests
933 979 adding file changes
934 980 added 5 changesets with 5 changes to 3 files (+2 heads)
935 981 2 new obsolescence markers
936 982 new changesets 4e3505fd9583:c922c0139ca0 (5 drafts)
937 983 updating to bookmark @
938 984 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
939 985 $ cd addmarks
940 986 $ echo foo > foo
941 987 $ hg add foo
942 988 $ hg commit -m 'add foo'
943 989 $ echo bar > bar
944 990 $ hg add bar
945 991 $ hg commit -m 'add bar'
946 992 $ hg co "tip^"
947 993 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
948 994 (leaving bookmark @)
949 995 $ hg book add-foo
950 996 $ hg book -r tip add-bar
951 997 Note: this push *must* push only a single changeset, as that's the point
952 998 of this test.
953 999 $ hg push -B add-foo --traceback
954 1000 pushing to http://localhost:$HGPORT/
955 1001 searching for changes
956 1002 remote: adding changesets
957 1003 remote: adding manifests
958 1004 remote: adding file changes
959 1005 remote: added 1 changesets with 1 changes to 1 files
960 1006 exporting bookmark add-foo
961 1007
962 1008 pushing a new bookmark on a new head does not require -f if -B is specified
963 1009
964 1010 $ hg up -q X
965 1011 $ hg book W
966 1012 $ echo c5 > f2
967 1013 $ hg ci -Am5
968 1014 created new head
969 1015 $ hg push -B .
970 1016 pushing to http://localhost:$HGPORT/
971 1017 searching for changes
972 1018 remote: adding changesets
973 1019 remote: adding manifests
974 1020 remote: adding file changes
975 1021 remote: added 1 changesets with 1 changes to 1 files (+1 heads)
976 1022 exporting bookmark W
977 1023 $ hg -R ../b id -r W
978 1024 cc978a373a53 tip W
979 1025
980 1026 pushing an existing but divergent bookmark with -B still requires -f
981 1027
982 1028 $ hg clone -q . ../r
983 1029 $ hg up -q X
984 1030 $ echo 1 > f2
985 1031 $ hg ci -qAml
986 1032
987 1033 $ cd ../r
988 1034 $ hg up -q X
989 1035 $ echo 2 > f2
990 1036 $ hg ci -qAmr
991 1037 $ hg push -B X
992 1038 pushing to $TESTTMP/addmarks
993 1039 searching for changes
994 1040 remote has heads on branch 'default' that are not known locally: a2a606d9ff1b
995 1041 abort: push creates new remote head 54694f811df9 with bookmark 'X'!
996 1042 (pull and merge or see 'hg help push' for details about pushing new heads)
997 1043 [255]
998 1044 $ cd ../addmarks
999 1045
1000 1046 Check summary output for incoming/outgoing bookmarks
1001 1047
1002 1048 $ hg bookmarks -d X
1003 1049 $ hg bookmarks -d Y
1004 1050 $ hg summary --remote | grep '^remote:'
1005 1051 remote: *, 2 incoming bookmarks, 1 outgoing bookmarks (glob)
1006 1052
1007 1053 $ cd ..
1008 1054
1009 1055 pushing an unchanged bookmark should result in no changes
1010 1056
1011 1057 $ hg init unchanged-a
1012 1058 $ hg init unchanged-b
1013 1059 $ cd unchanged-a
1014 1060 $ echo initial > foo
1015 1061 $ hg commit -A -m initial
1016 1062 adding foo
1017 1063 $ hg bookmark @
1018 1064 $ hg push -B @ ../unchanged-b
1019 1065 pushing to ../unchanged-b
1020 1066 searching for changes
1021 1067 adding changesets
1022 1068 adding manifests
1023 1069 adding file changes
1024 1070 added 1 changesets with 1 changes to 1 files
1025 1071 exporting bookmark @
1026 1072
1027 1073 $ hg push -B @ ../unchanged-b
1028 1074 pushing to ../unchanged-b
1029 1075 searching for changes
1030 1076 no changes found
1031 1077 [1]
1032 1078
1033 1079 Pushing a really long bookmark should work fine (issue5165)
1034 1080 ===============================================
1035 1081
1036 1082 #if b2-binary
1037 1083 >>> with open('longname', 'w') as f:
1038 1084 ... f.write('wat' * 100) and None
1039 1085 $ hg book `cat longname`
1040 1086 $ hg push -B `cat longname` ../unchanged-b
1041 1087 pushing to ../unchanged-b
1042 1088 searching for changes
1043 1089 no changes found
1044 1090 exporting bookmark (wat){100} (re)
1045 1091 [1]
1046 1092 $ hg -R ../unchanged-b book --delete `cat longname`
1047 1093
1048 1094 Test again but forcing bundle2 exchange to make sure that doesn't regress.
1049 1095
1050 1096 $ hg push -B `cat longname` ../unchanged-b --config devel.legacy.exchange=bundle1
1051 1097 pushing to ../unchanged-b
1052 1098 searching for changes
1053 1099 no changes found
1054 1100 exporting bookmark (wat){100} (re)
1055 1101 [1]
1056 1102 $ hg -R ../unchanged-b book --delete `cat longname`
1057 1103 $ hg book --delete `cat longname`
1058 1104 $ hg co @
1059 1105 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1060 1106 (activating bookmark @)
1061 1107 #endif
1062 1108
1063 1109 Check hook preventing push (issue4455)
1064 1110 ======================================
1065 1111
1066 1112 $ hg bookmarks
1067 1113 * @ 0:55482a6fb4b1
1068 1114 $ hg log -G
1069 1115 @ 0:55482a6fb4b1 initial
1070 1116
1071 1117 $ hg init ../issue4455-dest
1072 1118 $ hg push ../issue4455-dest # changesets only
1073 1119 pushing to ../issue4455-dest
1074 1120 searching for changes
1075 1121 adding changesets
1076 1122 adding manifests
1077 1123 adding file changes
1078 1124 added 1 changesets with 1 changes to 1 files
1079 1125 $ cat >> .hg/hgrc << EOF
1080 1126 > [paths]
1081 1127 > local=../issue4455-dest/
1082 1128 > ssh=ssh://user@dummy/issue4455-dest
1083 1129 > http=http://localhost:$HGPORT/
1084 1130 > [ui]
1085 1131 > ssh="$PYTHON" "$TESTDIR/dummyssh"
1086 1132 > EOF
1087 1133 $ cat >> ../issue4455-dest/.hg/hgrc << EOF
1088 1134 > [hooks]
1089 1135 > prepushkey=false
1090 1136 > [web]
1091 1137 > push_ssl = false
1092 1138 > allow_push = *
1093 1139 > EOF
1094 1140 $ killdaemons.py
1095 1141 $ hg serve -R ../issue4455-dest -p $HGPORT -d --pid-file=../issue4455.pid -E ../issue4455-error.log
1096 1142 $ cat ../issue4455.pid >> $DAEMON_PIDS
1097 1143
1098 1144 Local push
1099 1145 ----------
1100 1146
1101 1147 #if b2-pushkey
1102 1148
1103 1149 $ hg push -B @ local
1104 1150 pushing to $TESTTMP/issue4455-dest
1105 1151 searching for changes
1106 1152 no changes found
1107 1153 pushkey-abort: prepushkey hook exited with status 1
1108 1154 abort: exporting bookmark @ failed!
1109 1155 [255]
1110 1156
1111 1157 #endif
1112 1158 #if b2-binary
1113 1159
1114 1160 $ hg push -B @ local
1115 1161 pushing to $TESTTMP/issue4455-dest
1116 1162 searching for changes
1117 1163 no changes found
1118 1164 abort: prepushkey hook exited with status 1
1119 1165 [255]
1120 1166
1121 1167 #endif
1122 1168
1123 1169 $ hg -R ../issue4455-dest/ bookmarks
1124 1170 no bookmarks set
1125 1171
1126 1172 Using ssh
1127 1173 ---------
1128 1174
1129 1175 #if b2-pushkey
1130 1176
1131 1177 $ hg push -B @ ssh # bundle2+
1132 1178 pushing to ssh://user@dummy/issue4455-dest
1133 1179 searching for changes
1134 1180 no changes found
1135 1181 remote: pushkey-abort: prepushkey hook exited with status 1
1136 1182 abort: exporting bookmark @ failed!
1137 1183 [255]
1138 1184
1139 1185 $ hg -R ../issue4455-dest/ bookmarks
1140 1186 no bookmarks set
1141 1187
1142 1188 $ hg push -B @ ssh --config devel.legacy.exchange=bundle1
1143 1189 pushing to ssh://user@dummy/issue4455-dest
1144 1190 searching for changes
1145 1191 no changes found
1146 1192 remote: pushkey-abort: prepushkey hook exited with status 1
1147 1193 exporting bookmark @ failed!
1148 1194 [1]
1149 1195
1150 1196 #endif
1151 1197 #if b2-binary
1152 1198
1153 1199 $ hg push -B @ ssh # bundle2+
1154 1200 pushing to ssh://user@dummy/issue4455-dest
1155 1201 searching for changes
1156 1202 no changes found
1157 1203 remote: prepushkey hook exited with status 1
1158 1204 abort: push failed on remote
1159 1205 [255]
1160 1206
1161 1207 #endif
1162 1208
1163 1209 $ hg -R ../issue4455-dest/ bookmarks
1164 1210 no bookmarks set
1165 1211
1166 1212 Using http
1167 1213 ----------
1168 1214
1169 1215 #if b2-pushkey
1170 1216 $ hg push -B @ http # bundle2+
1171 1217 pushing to http://localhost:$HGPORT/
1172 1218 searching for changes
1173 1219 no changes found
1174 1220 remote: pushkey-abort: prepushkey hook exited with status 1
1175 1221 abort: exporting bookmark @ failed!
1176 1222 [255]
1177 1223
1178 1224 $ hg -R ../issue4455-dest/ bookmarks
1179 1225 no bookmarks set
1180 1226
1181 1227 $ hg push -B @ http --config devel.legacy.exchange=bundle1
1182 1228 pushing to http://localhost:$HGPORT/
1183 1229 searching for changes
1184 1230 no changes found
1185 1231 remote: pushkey-abort: prepushkey hook exited with status 1
1186 1232 exporting bookmark @ failed!
1187 1233 [1]
1188 1234
1189 1235 #endif
1190 1236
1191 1237 #if b2-binary
1192 1238
1193 1239 $ hg push -B @ ssh # bundle2+
1194 1240 pushing to ssh://user@dummy/issue4455-dest
1195 1241 searching for changes
1196 1242 no changes found
1197 1243 remote: prepushkey hook exited with status 1
1198 1244 abort: push failed on remote
1199 1245 [255]
1200 1246
1201 1247 #endif
1202 1248
1203 1249 $ hg -R ../issue4455-dest/ bookmarks
1204 1250 no bookmarks set
1205 1251
1206 1252 $ cd ..
1207 1253
1208 1254 Test that pre-pushkey compat for bookmark works as expected (issue5777)
1209 1255
1210 1256 $ cat << EOF >> $HGRCPATH
1211 1257 > [ui]
1212 1258 > ssh="$PYTHON" "$TESTDIR/dummyssh"
1213 1259 > [server]
1214 1260 > bookmarks-pushkey-compat = yes
1215 1261 > EOF
1216 1262
1217 1263 $ hg init server
1218 1264 $ echo foo > server/a
1219 1265 $ hg -R server book foo
1220 1266 $ hg -R server commit -Am a
1221 1267 adding a
1222 1268 $ hg clone ssh://user@dummy/server client
1223 1269 requesting all changes
1224 1270 adding changesets
1225 1271 adding manifests
1226 1272 adding file changes
1227 1273 added 1 changesets with 1 changes to 1 files
1228 1274 new changesets 79513d0d7716 (1 drafts)
1229 1275 updating to branch default
1230 1276 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1231 1277
1232 1278 Forbid bookmark move on the server
1233 1279
1234 1280 $ cat << EOF >> $TESTTMP/no-bm-move.sh
1235 1281 > #!/bin/sh
1236 1282 > echo \$HG_NAMESPACE | grep -v bookmarks
1237 1283 > EOF
1238 1284 $ cat << EOF >> server/.hg/hgrc
1239 1285 > [hooks]
1240 1286 > prepushkey.no-bm-move= sh $TESTTMP/no-bm-move.sh
1241 1287 > EOF
1242 1288
1243 1289 pushing changeset is okay
1244 1290
1245 1291 $ echo bar >> client/a
1246 1292 $ hg -R client commit -m b
1247 1293 $ hg -R client push
1248 1294 pushing to ssh://user@dummy/server
1249 1295 searching for changes
1250 1296 remote: adding changesets
1251 1297 remote: adding manifests
1252 1298 remote: adding file changes
1253 1299 remote: added 1 changesets with 1 changes to 1 files
1254 1300
1255 1301 attempt to move the bookmark is rejected
1256 1302
1257 1303 $ hg -R client book foo -r .
1258 1304 moving bookmark 'foo' forward from 79513d0d7716
1259 1305
1260 1306 #if b2-pushkey
1261 1307 $ hg -R client push
1262 1308 pushing to ssh://user@dummy/server
1263 1309 searching for changes
1264 1310 no changes found
1265 1311 remote: pushkey-abort: prepushkey.no-bm-move hook exited with status 1
1266 1312 abort: updating bookmark foo failed!
1267 1313 [255]
1268 1314 #endif
1269 1315 #if b2-binary
1270 1316 $ hg -R client push
1271 1317 pushing to ssh://user@dummy/server
1272 1318 searching for changes
1273 1319 no changes found
1274 1320 remote: prepushkey.no-bm-move hook exited with status 1
1275 1321 abort: push failed on remote
1276 1322 [255]
1277 1323 #endif
General Comments 0
You need to be logged in to leave comments. Login now