Debian Codegraph @

tests/test-bookmarks-pushpull.t

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