##// END OF EJS Templates
tests: adjust hooks for Windows...
Matt Harbison -
r34939:aa05b959 stable
parent child Browse files
Show More
@@ -1,906 +1,909 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=True
10 10 > evolution.exchange=True
11 11 > EOF
12 12
13 $ TESTHOOK='hooks.txnclose-bookmark.test=echo "test-hook-bookmark: $HG_BOOKMARK: $HG_OLDNODE -> $HG_NODE"'
13 $ cat > $TESTTMP/hook.sh <<'EOF'
14 > echo "test-hook-bookmark: $HG_BOOKMARK: $HG_OLDNODE -> $HG_NODE"
15 > EOF
16 $ TESTHOOK="hooks.txnclose-bookmark.test=sh $TESTTMP/hook.sh"
14 17
15 18 initialize
16 19
17 20 $ hg init a
18 21 $ cd a
19 22 $ echo 'test' > test
20 23 $ hg commit -Am'test'
21 24 adding test
22 25
23 26 set bookmarks
24 27
25 28 $ hg bookmark X
26 29 $ hg bookmark Y
27 30 $ hg bookmark Z
28 31
29 32 import bookmark by name
30 33
31 34 $ hg init ../b
32 35 $ cd ../b
33 36 $ hg book Y
34 37 $ hg book
35 38 * Y -1:000000000000
36 39 $ hg pull ../a --config "$TESTHOOK"
37 40 pulling from ../a
38 41 requesting all changes
39 42 adding changesets
40 43 adding manifests
41 44 adding file changes
42 45 added 1 changesets with 1 changes to 1 files
43 46 adding remote bookmark X
44 47 updating bookmark Y
45 48 adding remote bookmark Z
46 49 new changesets 4e3505fd9583
47 50 test-hook-bookmark: X: -> 4e3505fd95835d721066b76e75dbb8cc554d7f77
48 51 test-hook-bookmark: Y: 0000000000000000000000000000000000000000 -> 4e3505fd95835d721066b76e75dbb8cc554d7f77
49 52 test-hook-bookmark: Z: -> 4e3505fd95835d721066b76e75dbb8cc554d7f77
50 53 (run 'hg update' to get a working copy)
51 54 $ hg bookmarks
52 55 X 0:4e3505fd9583
53 56 * Y 0:4e3505fd9583
54 57 Z 0:4e3505fd9583
55 58 $ hg debugpushkey ../a namespaces
56 59 bookmarks
57 60 namespaces
58 61 obsolete
59 62 phases
60 63 $ hg debugpushkey ../a bookmarks
61 64 X 4e3505fd95835d721066b76e75dbb8cc554d7f77
62 65 Y 4e3505fd95835d721066b76e75dbb8cc554d7f77
63 66 Z 4e3505fd95835d721066b76e75dbb8cc554d7f77
64 67
65 68 delete the bookmark to re-pull it
66 69
67 70 $ hg book -d X
68 71 $ hg pull -B X ../a
69 72 pulling from ../a
70 73 no changes found
71 74 adding remote bookmark X
72 75
73 76 finally no-op pull
74 77
75 78 $ hg pull -B X ../a
76 79 pulling from ../a
77 80 no changes found
78 81 $ hg bookmark
79 82 X 0:4e3505fd9583
80 83 * Y 0:4e3505fd9583
81 84 Z 0:4e3505fd9583
82 85
83 86 export bookmark by name
84 87
85 88 $ hg bookmark W
86 89 $ hg bookmark foo
87 90 $ hg bookmark foobar
88 91 $ hg push -B W ../a
89 92 pushing to ../a
90 93 searching for changes
91 94 no changes found
92 95 exporting bookmark W
93 96 [1]
94 97 $ hg -R ../a bookmarks
95 98 W -1:000000000000
96 99 X 0:4e3505fd9583
97 100 Y 0:4e3505fd9583
98 101 * Z 0:4e3505fd9583
99 102
100 103 delete a remote bookmark
101 104
102 105 $ hg book -d W
103 106 $ hg push -B W ../a --config "$TESTHOOK"
104 107 pushing to ../a
105 108 searching for changes
106 109 no changes found
107 110 test-hook-bookmark: W: 0000000000000000000000000000000000000000 ->
108 111 deleting remote bookmark W
109 112 [1]
110 113
111 114 export the active bookmark
112 115
113 116 $ hg bookmark V
114 117 $ hg push -B . ../a
115 118 pushing to ../a
116 119 searching for changes
117 120 no changes found
118 121 exporting bookmark V
119 122 [1]
120 123
121 124 exporting the active bookmark with 'push -B .'
122 125 demand that one of the bookmarks is activated
123 126
124 127 $ hg update -r default
125 128 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
126 129 (leaving bookmark V)
127 130 $ hg push -B . ../a
128 131 abort: no active bookmark
129 132 [255]
130 133 $ hg update -r V
131 134 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
132 135 (activating bookmark V)
133 136
134 137 delete the bookmark
135 138
136 139 $ hg book -d V
137 140 $ hg push -B V ../a
138 141 pushing to ../a
139 142 searching for changes
140 143 no changes found
141 144 deleting remote bookmark V
142 145 [1]
143 146 $ hg up foobar
144 147 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
145 148 (activating bookmark foobar)
146 149
147 150 push/pull name that doesn't exist
148 151
149 152 $ hg push -B badname ../a
150 153 pushing to ../a
151 154 searching for changes
152 155 bookmark badname does not exist on the local or remote repository!
153 156 no changes found
154 157 [2]
155 158 $ hg pull -B anotherbadname ../a
156 159 pulling from ../a
157 160 abort: remote bookmark anotherbadname not found!
158 161 [255]
159 162
160 163 divergent bookmarks
161 164
162 165 $ cd ../a
163 166 $ echo c1 > f1
164 167 $ hg ci -Am1
165 168 adding f1
166 169 $ hg book -f @
167 170 $ hg book -f X
168 171 $ hg book
169 172 @ 1:0d2164f0ce0d
170 173 * X 1:0d2164f0ce0d
171 174 Y 0:4e3505fd9583
172 175 Z 1:0d2164f0ce0d
173 176
174 177 $ cd ../b
175 178 $ hg up --config
176 179 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
177 180 updating bookmark foobar
178 181 $ echo c2 > f2
179 182 $ hg ci -Am2
180 183 adding f2
181 184 $ hg book -if @
182 185 $ hg book -if X
183 186 $ hg book
184 187 @ 1:9b140be10808
185 188 X 1:9b140be10808
186 189 Y 0:4e3505fd9583
187 190 Z 0:4e3505fd9583
188 191 foo -1:000000000000
189 192 * foobar 1:9b140be10808
190 193
191 194 $ hg pull --config paths.foo=../a foo --config "$TESTHOOK"
192 195 pulling from $TESTTMP/a (glob)
193 196 searching for changes
194 197 adding changesets
195 198 adding manifests
196 199 adding file changes
197 200 added 1 changesets with 1 changes to 1 files (+1 heads)
198 201 divergent bookmark @ stored as @foo
199 202 divergent bookmark X stored as X@foo
200 203 updating bookmark Z
201 204 new changesets 0d2164f0ce0d
202 205 test-hook-bookmark: @foo: -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
203 206 test-hook-bookmark: X@foo: -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
204 207 test-hook-bookmark: Z: 4e3505fd95835d721066b76e75dbb8cc554d7f77 -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
205 208 (run 'hg heads' to see heads, 'hg merge' to merge)
206 209 $ hg book
207 210 @ 1:9b140be10808
208 211 @foo 2:0d2164f0ce0d
209 212 X 1:9b140be10808
210 213 X@foo 2:0d2164f0ce0d
211 214 Y 0:4e3505fd9583
212 215 Z 2:0d2164f0ce0d
213 216 foo -1:000000000000
214 217 * foobar 1:9b140be10808
215 218
216 219 (test that too many divergence of bookmark)
217 220
218 221 $ $PYTHON $TESTDIR/seq.py 1 100 | while read i; do hg bookmarks -r 000000000000 "X@${i}"; done
219 222 $ hg pull ../a
220 223 pulling from ../a
221 224 searching for changes
222 225 no changes found
223 226 warning: failed to assign numbered name to divergent bookmark X
224 227 divergent bookmark @ stored as @1
225 228 $ hg bookmarks | grep '^ X' | grep -v ':000000000000'
226 229 X 1:9b140be10808
227 230 X@foo 2:0d2164f0ce0d
228 231
229 232 (test that remotely diverged bookmarks are reused if they aren't changed)
230 233
231 234 $ hg bookmarks | grep '^ @'
232 235 @ 1:9b140be10808
233 236 @1 2:0d2164f0ce0d
234 237 @foo 2:0d2164f0ce0d
235 238 $ hg pull ../a
236 239 pulling from ../a
237 240 searching for changes
238 241 no changes found
239 242 warning: failed to assign numbered name to divergent bookmark X
240 243 divergent bookmark @ stored as @1
241 244 $ hg bookmarks | grep '^ @'
242 245 @ 1:9b140be10808
243 246 @1 2:0d2164f0ce0d
244 247 @foo 2:0d2164f0ce0d
245 248
246 249 $ $PYTHON $TESTDIR/seq.py 1 100 | while read i; do hg bookmarks -d "X@${i}"; done
247 250 $ hg bookmarks -d "@1"
248 251
249 252 $ hg push -f ../a
250 253 pushing to ../a
251 254 searching for changes
252 255 adding changesets
253 256 adding manifests
254 257 adding file changes
255 258 added 1 changesets with 1 changes to 1 files (+1 heads)
256 259 $ hg -R ../a book
257 260 @ 1:0d2164f0ce0d
258 261 * X 1:0d2164f0ce0d
259 262 Y 0:4e3505fd9583
260 263 Z 1:0d2164f0ce0d
261 264
262 265 explicit pull should overwrite the local version (issue4439)
263 266
264 267 $ hg update -r X
265 268 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
266 269 (activating bookmark X)
267 270 $ hg pull --config paths.foo=../a foo -B . --config "$TESTHOOK"
268 271 pulling from $TESTTMP/a (glob)
269 272 no changes found
270 273 divergent bookmark @ stored as @foo
271 274 importing bookmark X
272 275 test-hook-bookmark: @foo: 0d2164f0ce0d8f1d6f94351eba04b794909be66c -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
273 276 test-hook-bookmark: X: 9b140be1080824d768c5a4691a564088eede71f9 -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
274 277
275 278 reinstall state for further testing:
276 279
277 280 $ hg book -fr 9b140be10808 X
278 281
279 282 revsets should not ignore divergent bookmarks
280 283
281 284 $ hg bookmark -fr 1 Z
282 285 $ hg log -r 'bookmark()' --template '{rev}:{node|short} {bookmarks}\n'
283 286 0:4e3505fd9583 Y
284 287 1:9b140be10808 @ X Z foobar
285 288 2:0d2164f0ce0d @foo X@foo
286 289 $ hg log -r 'bookmark("X@foo")' --template '{rev}:{node|short} {bookmarks}\n'
287 290 2:0d2164f0ce0d @foo X@foo
288 291 $ hg log -r 'bookmark("re:X@foo")' --template '{rev}:{node|short} {bookmarks}\n'
289 292 2:0d2164f0ce0d @foo X@foo
290 293
291 294 update a remote bookmark from a non-head to a head
292 295
293 296 $ hg up -q Y
294 297 $ echo c3 > f2
295 298 $ hg ci -Am3
296 299 adding f2
297 300 created new head
298 301 $ hg push ../a --config "$TESTHOOK"
299 302 pushing to ../a
300 303 searching for changes
301 304 adding changesets
302 305 adding manifests
303 306 adding file changes
304 307 added 1 changesets with 1 changes to 1 files (+1 heads)
305 308 test-hook-bookmark: Y: 4e3505fd95835d721066b76e75dbb8cc554d7f77 -> f6fc62dde3c0771e29704af56ba4d8af77abcc2f
306 309 updating bookmark Y
307 310 $ hg -R ../a book
308 311 @ 1:0d2164f0ce0d
309 312 * X 1:0d2164f0ce0d
310 313 Y 3:f6fc62dde3c0
311 314 Z 1:0d2164f0ce0d
312 315
313 316 update a bookmark in the middle of a client pulling changes
314 317
315 318 $ cd ..
316 319 $ hg clone -q a pull-race
317 320
318 321 We want to use http because it is stateless and therefore more susceptible to
319 322 race conditions
320 323
321 324 $ hg serve -R pull-race -p $HGPORT -d --pid-file=pull-race.pid -E main-error.log
322 325 $ cat pull-race.pid >> $DAEMON_PIDS
323 326
324 327 $ cat <<EOF > $TESTTMP/out_makecommit.sh
325 328 > #!/bin/sh
326 329 > hg ci -Am5
327 330 > echo committed in pull-race
328 331 > EOF
329 332
330 333 $ hg clone -q http://localhost:$HGPORT/ pull-race2 --config "$TESTHOOK"
331 334 test-hook-bookmark: @: -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
332 335 test-hook-bookmark: X: -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
333 336 test-hook-bookmark: Y: -> f6fc62dde3c0771e29704af56ba4d8af77abcc2f
334 337 test-hook-bookmark: Z: -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
335 338 $ cd pull-race
336 339 $ hg up -q Y
337 340 $ echo c4 > f2
338 341 $ hg ci -Am4
339 342 $ echo c5 > f3
340 343 $ cat <<EOF > .hg/hgrc
341 344 > [hooks]
342 345 > outgoing.makecommit = sh $TESTTMP/out_makecommit.sh
343 346 > EOF
344 347
345 348 (new config needs a server restart)
346 349
347 350 $ cd ..
348 351 $ killdaemons.py
349 352 $ hg serve -R pull-race -p $HGPORT -d --pid-file=pull-race.pid -E main-error.log
350 353 $ cat pull-race.pid >> $DAEMON_PIDS
351 354 $ cd pull-race2
352 355 $ hg -R $TESTTMP/pull-race book
353 356 @ 1:0d2164f0ce0d
354 357 X 1:0d2164f0ce0d
355 358 * Y 4:b0a5eff05604
356 359 Z 1:0d2164f0ce0d
357 360 $ hg pull
358 361 pulling from http://localhost:$HGPORT/
359 362 searching for changes
360 363 adding changesets
361 364 adding manifests
362 365 adding file changes
363 366 added 1 changesets with 1 changes to 1 files
364 367 updating bookmark Y
365 368 new changesets b0a5eff05604
366 369 (run 'hg update' to get a working copy)
367 370 $ hg book
368 371 * @ 1:0d2164f0ce0d
369 372 X 1:0d2164f0ce0d
370 373 Y 4:b0a5eff05604
371 374 Z 1:0d2164f0ce0d
372 375
373 376 Update a bookmark right after the initial lookup -B (issue4689)
374 377
375 378 $ echo c6 > ../pull-race/f3 # to be committed during the race
376 379 $ cat <<EOF > $TESTTMP/listkeys_makecommit.sh
377 380 > #!/bin/sh
378 381 > if hg st | grep -q M; then
379 382 > hg commit -m race
380 383 > echo committed in pull-race
381 384 > else
382 385 > exit 0
383 386 > fi
384 387 > EOF
385 388 $ cat <<EOF > ../pull-race/.hg/hgrc
386 389 > [hooks]
387 390 > # If anything to commit, commit it right after the first key listing used
388 391 > # during lookup. This makes the commit appear before the actual getbundle
389 392 > # call.
390 393 > listkeys.makecommit= sh $TESTTMP/listkeys_makecommit.sh
391 394 > EOF
392 395
393 396 (new config need server restart)
394 397
395 398 $ killdaemons.py
396 399 $ hg serve -R ../pull-race -p $HGPORT -d --pid-file=../pull-race.pid -E main-error.log
397 400 $ cat ../pull-race.pid >> $DAEMON_PIDS
398 401
399 402 $ hg -R $TESTTMP/pull-race book
400 403 @ 1:0d2164f0ce0d
401 404 X 1:0d2164f0ce0d
402 405 * Y 5:35d1ef0a8d1b
403 406 Z 1:0d2164f0ce0d
404 407 $ hg update -r Y
405 408 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
406 409 (activating bookmark Y)
407 410 $ hg pull -B .
408 411 pulling from http://localhost:$HGPORT/
409 412 searching for changes
410 413 adding changesets
411 414 adding manifests
412 415 adding file changes
413 416 added 1 changesets with 1 changes to 1 files
414 417 updating bookmark Y
415 418 new changesets 35d1ef0a8d1b
416 419 (run 'hg update' to get a working copy)
417 420 $ hg book
418 421 @ 1:0d2164f0ce0d
419 422 X 1:0d2164f0ce0d
420 423 * Y 5:35d1ef0a8d1b
421 424 Z 1:0d2164f0ce0d
422 425
423 426 (done with this section of the test)
424 427
425 428 $ killdaemons.py
426 429 $ cd ../b
427 430
428 431 diverging a remote bookmark fails
429 432
430 433 $ hg up -q 4e3505fd9583
431 434 $ echo c4 > f2
432 435 $ hg ci -Am4
433 436 adding f2
434 437 created new head
435 438 $ echo c5 > f2
436 439 $ hg ci -Am5
437 440 $ hg log -G
438 441 @ 5:c922c0139ca0 5
439 442 |
440 443 o 4:4efff6d98829 4
441 444 |
442 445 | o 3:f6fc62dde3c0 3
443 446 |/
444 447 | o 2:0d2164f0ce0d 1
445 448 |/
446 449 | o 1:9b140be10808 2
447 450 |/
448 451 o 0:4e3505fd9583 test
449 452
450 453
451 454 $ hg book -f Y
452 455
453 456 $ cat <<EOF > ../a/.hg/hgrc
454 457 > [web]
455 458 > push_ssl = false
456 459 > allow_push = *
457 460 > EOF
458 461
459 462 $ hg serve -R ../a -p $HGPORT2 -d --pid-file=../hg2.pid
460 463 $ cat ../hg2.pid >> $DAEMON_PIDS
461 464
462 465 $ hg push http://localhost:$HGPORT2/
463 466 pushing to http://localhost:$HGPORT2/
464 467 searching for changes
465 468 abort: push creates new remote head c922c0139ca0 with bookmark 'Y'!
466 469 (merge or see 'hg help push' for details about pushing new heads)
467 470 [255]
468 471 $ hg -R ../a book
469 472 @ 1:0d2164f0ce0d
470 473 * X 1:0d2164f0ce0d
471 474 Y 3:f6fc62dde3c0
472 475 Z 1:0d2164f0ce0d
473 476
474 477
475 478 Unrelated marker does not alter the decision
476 479
477 480 $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
478 481 $ hg push http://localhost:$HGPORT2/
479 482 pushing to http://localhost:$HGPORT2/
480 483 searching for changes
481 484 abort: push creates new remote head c922c0139ca0 with bookmark 'Y'!
482 485 (merge or see 'hg help push' for details about pushing new heads)
483 486 [255]
484 487 $ hg -R ../a book
485 488 @ 1:0d2164f0ce0d
486 489 * X 1:0d2164f0ce0d
487 490 Y 3:f6fc62dde3c0
488 491 Z 1:0d2164f0ce0d
489 492
490 493 Update to a successor works
491 494
492 495 $ hg id --debug -r 3
493 496 f6fc62dde3c0771e29704af56ba4d8af77abcc2f
494 497 $ hg id --debug -r 4
495 498 4efff6d98829d9c824c621afd6e3f01865f5439f
496 499 $ hg id --debug -r 5
497 500 c922c0139ca03858f655e4a2af4dd02796a63969 tip Y
498 501 $ hg debugobsolete f6fc62dde3c0771e29704af56ba4d8af77abcc2f cccccccccccccccccccccccccccccccccccccccc
499 502 obsoleted 1 changesets
500 503 $ hg debugobsolete cccccccccccccccccccccccccccccccccccccccc 4efff6d98829d9c824c621afd6e3f01865f5439f
501 504 $ hg push http://localhost:$HGPORT2/
502 505 pushing to http://localhost:$HGPORT2/
503 506 searching for changes
504 507 remote: adding changesets
505 508 remote: adding manifests
506 509 remote: adding file changes
507 510 remote: added 2 changesets with 2 changes to 1 files (+1 heads)
508 511 remote: 2 new obsolescence markers
509 512 remote: obsoleted 1 changesets
510 513 updating bookmark Y
511 514 $ hg -R ../a book
512 515 @ 1:0d2164f0ce0d
513 516 * X 1:0d2164f0ce0d
514 517 Y 5:c922c0139ca0
515 518 Z 1:0d2164f0ce0d
516 519
517 520 hgweb
518 521
519 522 $ cat <<EOF > .hg/hgrc
520 523 > [web]
521 524 > push_ssl = false
522 525 > allow_push = *
523 526 > EOF
524 527
525 528 $ hg serve -p $HGPORT -d --pid-file=../hg.pid -E errors.log
526 529 $ cat ../hg.pid >> $DAEMON_PIDS
527 530 $ cd ../a
528 531
529 532 $ hg debugpushkey http://localhost:$HGPORT/ namespaces
530 533 bookmarks
531 534 namespaces
532 535 obsolete
533 536 phases
534 537 $ hg debugpushkey http://localhost:$HGPORT/ bookmarks
535 538 @ 9b140be1080824d768c5a4691a564088eede71f9
536 539 X 9b140be1080824d768c5a4691a564088eede71f9
537 540 Y c922c0139ca03858f655e4a2af4dd02796a63969
538 541 Z 9b140be1080824d768c5a4691a564088eede71f9
539 542 foo 0000000000000000000000000000000000000000
540 543 foobar 9b140be1080824d768c5a4691a564088eede71f9
541 544 $ hg out -B http://localhost:$HGPORT/
542 545 comparing with http://localhost:$HGPORT/
543 546 searching for changed bookmarks
544 547 @ 0d2164f0ce0d
545 548 X 0d2164f0ce0d
546 549 Z 0d2164f0ce0d
547 550 foo
548 551 foobar
549 552 $ hg push -B Z http://localhost:$HGPORT/
550 553 pushing to http://localhost:$HGPORT/
551 554 searching for changes
552 555 no changes found
553 556 updating bookmark Z
554 557 [1]
555 558 $ hg book -d Z
556 559 $ hg in -B http://localhost:$HGPORT/
557 560 comparing with http://localhost:$HGPORT/
558 561 searching for changed bookmarks
559 562 @ 9b140be10808
560 563 X 9b140be10808
561 564 Z 0d2164f0ce0d
562 565 foo 000000000000
563 566 foobar 9b140be10808
564 567 $ hg pull -B Z http://localhost:$HGPORT/
565 568 pulling from http://localhost:$HGPORT/
566 569 no changes found
567 570 divergent bookmark @ stored as @1
568 571 divergent bookmark X stored as X@1
569 572 adding remote bookmark Z
570 573 adding remote bookmark foo
571 574 adding remote bookmark foobar
572 575 $ hg clone http://localhost:$HGPORT/ cloned-bookmarks
573 576 requesting all changes
574 577 adding changesets
575 578 adding manifests
576 579 adding file changes
577 580 added 5 changesets with 5 changes to 3 files (+2 heads)
578 581 2 new obsolescence markers
579 582 new changesets 4e3505fd9583:c922c0139ca0
580 583 updating to bookmark @
581 584 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
582 585 $ hg -R cloned-bookmarks bookmarks
583 586 * @ 1:9b140be10808
584 587 X 1:9b140be10808
585 588 Y 4:c922c0139ca0
586 589 Z 2:0d2164f0ce0d
587 590 foo -1:000000000000
588 591 foobar 1:9b140be10808
589 592
590 593 $ cd ..
591 594
592 595 Test to show result of bookmarks comparison
593 596
594 597 $ mkdir bmcomparison
595 598 $ cd bmcomparison
596 599
597 600 $ hg init source
598 601 $ hg -R source debugbuilddag '+2*2*3*4'
599 602 $ hg -R source log -G --template '{rev}:{node|short}'
600 603 o 4:e7bd5218ca15
601 604 |
602 605 | o 3:6100d3090acf
603 606 |/
604 607 | o 2:fa942426a6fd
605 608 |/
606 609 | o 1:66f7d451a68b
607 610 |/
608 611 o 0:1ea73414a91b
609 612
610 613 $ hg -R source bookmarks -r 0 SAME
611 614 $ hg -R source bookmarks -r 0 ADV_ON_REPO1
612 615 $ hg -R source bookmarks -r 0 ADV_ON_REPO2
613 616 $ hg -R source bookmarks -r 0 DIFF_ADV_ON_REPO1
614 617 $ hg -R source bookmarks -r 0 DIFF_ADV_ON_REPO2
615 618 $ hg -R source bookmarks -r 1 DIVERGED
616 619
617 620 $ hg clone -U source repo1
618 621
619 622 (test that incoming/outgoing exit with 1, if there is no bookmark to
620 623 be exchanged)
621 624
622 625 $ hg -R repo1 incoming -B
623 626 comparing with $TESTTMP/bmcomparison/source (glob)
624 627 searching for changed bookmarks
625 628 no changed bookmarks found
626 629 [1]
627 630 $ hg -R repo1 outgoing -B
628 631 comparing with $TESTTMP/bmcomparison/source (glob)
629 632 searching for changed bookmarks
630 633 no changed bookmarks found
631 634 [1]
632 635
633 636 $ hg -R repo1 bookmarks -f -r 1 ADD_ON_REPO1
634 637 $ hg -R repo1 bookmarks -f -r 2 ADV_ON_REPO1
635 638 $ hg -R repo1 bookmarks -f -r 3 DIFF_ADV_ON_REPO1
636 639 $ hg -R repo1 bookmarks -f -r 3 DIFF_DIVERGED
637 640 $ hg -R repo1 -q --config extensions.mq= strip 4
638 641 $ hg -R repo1 log -G --template '{node|short} ({bookmarks})'
639 642 o 6100d3090acf (DIFF_ADV_ON_REPO1 DIFF_DIVERGED)
640 643 |
641 644 | o fa942426a6fd (ADV_ON_REPO1)
642 645 |/
643 646 | o 66f7d451a68b (ADD_ON_REPO1 DIVERGED)
644 647 |/
645 648 o 1ea73414a91b (ADV_ON_REPO2 DIFF_ADV_ON_REPO2 SAME)
646 649
647 650
648 651 $ hg clone -U source repo2
649 652 $ hg -R repo2 bookmarks -f -r 1 ADD_ON_REPO2
650 653 $ hg -R repo2 bookmarks -f -r 1 ADV_ON_REPO2
651 654 $ hg -R repo2 bookmarks -f -r 2 DIVERGED
652 655 $ hg -R repo2 bookmarks -f -r 4 DIFF_ADV_ON_REPO2
653 656 $ hg -R repo2 bookmarks -f -r 4 DIFF_DIVERGED
654 657 $ hg -R repo2 -q --config extensions.mq= strip 3
655 658 $ hg -R repo2 log -G --template '{node|short} ({bookmarks})'
656 659 o e7bd5218ca15 (DIFF_ADV_ON_REPO2 DIFF_DIVERGED)
657 660 |
658 661 | o fa942426a6fd (DIVERGED)
659 662 |/
660 663 | o 66f7d451a68b (ADD_ON_REPO2 ADV_ON_REPO2)
661 664 |/
662 665 o 1ea73414a91b (ADV_ON_REPO1 DIFF_ADV_ON_REPO1 SAME)
663 666
664 667
665 668 (test that difference of bookmarks between repositories are fully shown)
666 669
667 670 $ hg -R repo1 incoming -B repo2 -v
668 671 comparing with repo2
669 672 searching for changed bookmarks
670 673 ADD_ON_REPO2 66f7d451a68b added
671 674 ADV_ON_REPO2 66f7d451a68b advanced
672 675 DIFF_ADV_ON_REPO2 e7bd5218ca15 changed
673 676 DIFF_DIVERGED e7bd5218ca15 changed
674 677 DIVERGED fa942426a6fd diverged
675 678 $ hg -R repo1 outgoing -B repo2 -v
676 679 comparing with repo2
677 680 searching for changed bookmarks
678 681 ADD_ON_REPO1 66f7d451a68b added
679 682 ADD_ON_REPO2 deleted
680 683 ADV_ON_REPO1 fa942426a6fd advanced
681 684 DIFF_ADV_ON_REPO1 6100d3090acf advanced
682 685 DIFF_ADV_ON_REPO2 1ea73414a91b changed
683 686 DIFF_DIVERGED 6100d3090acf changed
684 687 DIVERGED 66f7d451a68b diverged
685 688
686 689 $ hg -R repo2 incoming -B repo1 -v
687 690 comparing with repo1
688 691 searching for changed bookmarks
689 692 ADD_ON_REPO1 66f7d451a68b added
690 693 ADV_ON_REPO1 fa942426a6fd advanced
691 694 DIFF_ADV_ON_REPO1 6100d3090acf changed
692 695 DIFF_DIVERGED 6100d3090acf changed
693 696 DIVERGED 66f7d451a68b diverged
694 697 $ hg -R repo2 outgoing -B repo1 -v
695 698 comparing with repo1
696 699 searching for changed bookmarks
697 700 ADD_ON_REPO1 deleted
698 701 ADD_ON_REPO2 66f7d451a68b added
699 702 ADV_ON_REPO2 66f7d451a68b advanced
700 703 DIFF_ADV_ON_REPO1 1ea73414a91b changed
701 704 DIFF_ADV_ON_REPO2 e7bd5218ca15 advanced
702 705 DIFF_DIVERGED e7bd5218ca15 changed
703 706 DIVERGED fa942426a6fd diverged
704 707
705 708 $ cd ..
706 709
707 710 Pushing a bookmark should only push the changes required by that
708 711 bookmark, not all outgoing changes:
709 712 $ hg clone http://localhost:$HGPORT/ addmarks
710 713 requesting all changes
711 714 adding changesets
712 715 adding manifests
713 716 adding file changes
714 717 added 5 changesets with 5 changes to 3 files (+2 heads)
715 718 2 new obsolescence markers
716 719 new changesets 4e3505fd9583:c922c0139ca0
717 720 updating to bookmark @
718 721 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
719 722 $ cd addmarks
720 723 $ echo foo > foo
721 724 $ hg add foo
722 725 $ hg commit -m 'add foo'
723 726 $ echo bar > bar
724 727 $ hg add bar
725 728 $ hg commit -m 'add bar'
726 729 $ hg co "tip^"
727 730 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
728 731 (leaving bookmark @)
729 732 $ hg book add-foo
730 733 $ hg book -r tip add-bar
731 734 Note: this push *must* push only a single changeset, as that's the point
732 735 of this test.
733 736 $ hg push -B add-foo --traceback
734 737 pushing to http://localhost:$HGPORT/
735 738 searching for changes
736 739 remote: adding changesets
737 740 remote: adding manifests
738 741 remote: adding file changes
739 742 remote: added 1 changesets with 1 changes to 1 files
740 743 exporting bookmark add-foo
741 744
742 745 pushing a new bookmark on a new head does not require -f if -B is specified
743 746
744 747 $ hg up -q X
745 748 $ hg book W
746 749 $ echo c5 > f2
747 750 $ hg ci -Am5
748 751 created new head
749 752 $ hg push -B .
750 753 pushing to http://localhost:$HGPORT/
751 754 searching for changes
752 755 remote: adding changesets
753 756 remote: adding manifests
754 757 remote: adding file changes
755 758 remote: added 1 changesets with 1 changes to 1 files (+1 heads)
756 759 exporting bookmark W
757 760 $ hg -R ../b id -r W
758 761 cc978a373a53 tip W
759 762
760 763 pushing an existing but divergent bookmark with -B still requires -f
761 764
762 765 $ hg clone -q . ../r
763 766 $ hg up -q X
764 767 $ echo 1 > f2
765 768 $ hg ci -qAml
766 769
767 770 $ cd ../r
768 771 $ hg up -q X
769 772 $ echo 2 > f2
770 773 $ hg ci -qAmr
771 774 $ hg push -B X
772 775 pushing to $TESTTMP/addmarks (glob)
773 776 searching for changes
774 777 remote has heads on branch 'default' that are not known locally: a2a606d9ff1b
775 778 abort: push creates new remote head 54694f811df9 with bookmark 'X'!
776 779 (pull and merge or see 'hg help push' for details about pushing new heads)
777 780 [255]
778 781 $ cd ../addmarks
779 782
780 783 Check summary output for incoming/outgoing bookmarks
781 784
782 785 $ hg bookmarks -d X
783 786 $ hg bookmarks -d Y
784 787 $ hg summary --remote | grep '^remote:'
785 788 remote: *, 2 incoming bookmarks, 1 outgoing bookmarks (glob)
786 789
787 790 $ cd ..
788 791
789 792 pushing an unchanged bookmark should result in no changes
790 793
791 794 $ hg init unchanged-a
792 795 $ hg init unchanged-b
793 796 $ cd unchanged-a
794 797 $ echo initial > foo
795 798 $ hg commit -A -m initial
796 799 adding foo
797 800 $ hg bookmark @
798 801 $ hg push -B @ ../unchanged-b
799 802 pushing to ../unchanged-b
800 803 searching for changes
801 804 adding changesets
802 805 adding manifests
803 806 adding file changes
804 807 added 1 changesets with 1 changes to 1 files
805 808 exporting bookmark @
806 809
807 810 $ hg push -B @ ../unchanged-b
808 811 pushing to ../unchanged-b
809 812 searching for changes
810 813 no changes found
811 814 [1]
812 815
813 816
814 817 Check hook preventing push (issue4455)
815 818 ======================================
816 819
817 820 $ hg bookmarks
818 821 * @ 0:55482a6fb4b1
819 822 $ hg log -G
820 823 @ 0:55482a6fb4b1 initial
821 824
822 825 $ hg init ../issue4455-dest
823 826 $ hg push ../issue4455-dest # changesets only
824 827 pushing to ../issue4455-dest
825 828 searching for changes
826 829 adding changesets
827 830 adding manifests
828 831 adding file changes
829 832 added 1 changesets with 1 changes to 1 files
830 833 $ cat >> .hg/hgrc << EOF
831 834 > [paths]
832 835 > local=../issue4455-dest/
833 836 > ssh=ssh://user@dummy/issue4455-dest
834 837 > http=http://localhost:$HGPORT/
835 838 > [ui]
836 839 > ssh=$PYTHON "$TESTDIR/dummyssh"
837 840 > EOF
838 841 $ cat >> ../issue4455-dest/.hg/hgrc << EOF
839 842 > [hooks]
840 843 > prepushkey=false
841 844 > [web]
842 845 > push_ssl = false
843 846 > allow_push = *
844 847 > EOF
845 848 $ killdaemons.py
846 849 $ hg serve -R ../issue4455-dest -p $HGPORT -d --pid-file=../issue4455.pid -E ../issue4455-error.log
847 850 $ cat ../issue4455.pid >> $DAEMON_PIDS
848 851
849 852 Local push
850 853 ----------
851 854
852 855 $ hg push -B @ local
853 856 pushing to $TESTTMP/issue4455-dest (glob)
854 857 searching for changes
855 858 no changes found
856 859 pushkey-abort: prepushkey hook exited with status 1
857 860 abort: exporting bookmark @ failed!
858 861 [255]
859 862 $ hg -R ../issue4455-dest/ bookmarks
860 863 no bookmarks set
861 864
862 865 Using ssh
863 866 ---------
864 867
865 868 $ hg push -B @ ssh # bundle2+
866 869 pushing to ssh://user@dummy/issue4455-dest
867 870 searching for changes
868 871 no changes found
869 872 remote: pushkey-abort: prepushkey hook exited with status 1
870 873 abort: exporting bookmark @ failed!
871 874 [255]
872 875 $ hg -R ../issue4455-dest/ bookmarks
873 876 no bookmarks set
874 877
875 878 $ hg push -B @ ssh --config devel.legacy.exchange=bundle1
876 879 pushing to ssh://user@dummy/issue4455-dest
877 880 searching for changes
878 881 no changes found
879 882 remote: pushkey-abort: prepushkey hook exited with status 1
880 883 exporting bookmark @ failed!
881 884 [1]
882 885 $ hg -R ../issue4455-dest/ bookmarks
883 886 no bookmarks set
884 887
885 888 Using http
886 889 ----------
887 890
888 891 $ hg push -B @ http # bundle2+
889 892 pushing to http://localhost:$HGPORT/
890 893 searching for changes
891 894 no changes found
892 895 remote: pushkey-abort: prepushkey hook exited with status 1
893 896 abort: exporting bookmark @ failed!
894 897 [255]
895 898 $ hg -R ../issue4455-dest/ bookmarks
896 899 no bookmarks set
897 900
898 901 $ hg push -B @ http --config devel.legacy.exchange=bundle1
899 902 pushing to http://localhost:$HGPORT/
900 903 searching for changes
901 904 no changes found
902 905 remote: pushkey-abort: prepushkey hook exited with status 1
903 906 exporting bookmark @ failed!
904 907 [1]
905 908 $ hg -R ../issue4455-dest/ bookmarks
906 909 no bookmarks set
@@ -1,1161 +1,1164 b''
1 1
2 2 $ hg init repo
3 3 $ cd repo
4 4
5 $ TESTHOOK='hooks.txnclose-bookmark.test=echo "test-hook-bookmark: $HG_BOOKMARK: $HG_OLDNODE -> $HG_NODE"'
5 $ cat > $TESTTMP/hook.sh <<'EOF'
6 > echo "test-hook-bookmark: $HG_BOOKMARK: $HG_OLDNODE -> $HG_NODE"
7 > EOF
8 $ TESTHOOK="hooks.txnclose-bookmark.test=sh $TESTTMP/hook.sh"
6 9
7 10 no bookmarks
8 11
9 12 $ hg bookmarks
10 13 no bookmarks set
11 14
12 15 $ hg bookmarks -Tjson
13 16 [
14 17 ]
15 18
16 19 bookmark rev -1
17 20
18 21 $ hg bookmark X --config "$TESTHOOK"
19 22 test-hook-bookmark: X: -> 0000000000000000000000000000000000000000
20 23
21 24 list bookmarks
22 25
23 26 $ hg bookmarks
24 27 * X -1:000000000000
25 28
26 29 list bookmarks with color
27 30
28 31 $ hg --config extensions.color= --config color.mode=ansi \
29 32 > bookmarks --color=always
30 33 \x1b[0;32m * \x1b[0m\x1b[0;32mX\x1b[0m\x1b[0;32m -1:000000000000\x1b[0m (esc)
31 34
32 35 $ echo a > a
33 36 $ hg add a
34 37 $ hg commit -m 0 --config "$TESTHOOK"
35 38 test-hook-bookmark: X: 0000000000000000000000000000000000000000 -> f7b1eb17ad24730a1651fccd46c43826d1bbc2ac
36 39
37 40 bookmark X moved to rev 0
38 41
39 42 $ hg bookmarks
40 43 * X 0:f7b1eb17ad24
41 44
42 45 look up bookmark
43 46
44 47 $ hg log -r X
45 48 changeset: 0:f7b1eb17ad24
46 49 bookmark: X
47 50 tag: tip
48 51 user: test
49 52 date: Thu Jan 01 00:00:00 1970 +0000
50 53 summary: 0
51 54
52 55
53 56 second bookmark for rev 0, command should work even with ui.strict on
54 57
55 58 $ hg --config ui.strict=1 bookmark X2 --config "$TESTHOOK"
56 59 test-hook-bookmark: X2: -> f7b1eb17ad24730a1651fccd46c43826d1bbc2ac
57 60
58 61 bookmark rev -1 again
59 62
60 63 $ hg bookmark -r null Y
61 64
62 65 list bookmarks
63 66
64 67 $ hg bookmarks
65 68 X 0:f7b1eb17ad24
66 69 * X2 0:f7b1eb17ad24
67 70 Y -1:000000000000
68 71
69 72 $ echo b > b
70 73 $ hg add b
71 74 $ hg commit -m 1 --config "$TESTHOOK"
72 75 test-hook-bookmark: X2: f7b1eb17ad24730a1651fccd46c43826d1bbc2ac -> 925d80f479bb026b0fb3deb27503780b13f74123
73 76
74 77 $ hg bookmarks -Tjson
75 78 [
76 79 {
77 80 "active": false,
78 81 "bookmark": "X",
79 82 "node": "f7b1eb17ad24730a1651fccd46c43826d1bbc2ac",
80 83 "rev": 0
81 84 },
82 85 {
83 86 "active": true,
84 87 "bookmark": "X2",
85 88 "node": "925d80f479bb026b0fb3deb27503780b13f74123",
86 89 "rev": 1
87 90 },
88 91 {
89 92 "active": false,
90 93 "bookmark": "Y",
91 94 "node": "0000000000000000000000000000000000000000",
92 95 "rev": -1
93 96 }
94 97 ]
95 98
96 99 bookmarks revset
97 100
98 101 $ hg log -r 'bookmark()'
99 102 changeset: 0:f7b1eb17ad24
100 103 bookmark: X
101 104 user: test
102 105 date: Thu Jan 01 00:00:00 1970 +0000
103 106 summary: 0
104 107
105 108 changeset: 1:925d80f479bb
106 109 bookmark: X2
107 110 tag: tip
108 111 user: test
109 112 date: Thu Jan 01 00:00:00 1970 +0000
110 113 summary: 1
111 114
112 115 $ hg log -r 'bookmark(Y)'
113 116 $ hg log -r 'bookmark(X2)'
114 117 changeset: 1:925d80f479bb
115 118 bookmark: X2
116 119 tag: tip
117 120 user: test
118 121 date: Thu Jan 01 00:00:00 1970 +0000
119 122 summary: 1
120 123
121 124 $ hg log -r 'bookmark("re:X")'
122 125 changeset: 0:f7b1eb17ad24
123 126 bookmark: X
124 127 user: test
125 128 date: Thu Jan 01 00:00:00 1970 +0000
126 129 summary: 0
127 130
128 131 changeset: 1:925d80f479bb
129 132 bookmark: X2
130 133 tag: tip
131 134 user: test
132 135 date: Thu Jan 01 00:00:00 1970 +0000
133 136 summary: 1
134 137
135 138 $ hg log -r 'bookmark("literal:X")'
136 139 changeset: 0:f7b1eb17ad24
137 140 bookmark: X
138 141 user: test
139 142 date: Thu Jan 01 00:00:00 1970 +0000
140 143 summary: 0
141 144
142 145
143 146 $ hg log -r 'bookmark(unknown)'
144 147 abort: bookmark 'unknown' does not exist!
145 148 [255]
146 149 $ hg log -r 'bookmark("literal:unknown")'
147 150 abort: bookmark 'unknown' does not exist!
148 151 [255]
149 152 $ hg log -r 'bookmark("re:unknown")'
150 153 abort: no bookmarks exist that match 'unknown'!
151 154 [255]
152 155 $ hg log -r 'present(bookmark("literal:unknown"))'
153 156 $ hg log -r 'present(bookmark("re:unknown"))'
154 157
155 158 $ hg help revsets | grep 'bookmark('
156 159 "bookmark([name])"
157 160
158 161 bookmarks X and X2 moved to rev 1, Y at rev -1
159 162
160 163 $ hg bookmarks
161 164 X 0:f7b1eb17ad24
162 165 * X2 1:925d80f479bb
163 166 Y -1:000000000000
164 167
165 168 bookmark rev 0 again
166 169
167 170 $ hg bookmark -r 0 Z
168 171
169 172 $ hg update X
170 173 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
171 174 (activating bookmark X)
172 175 $ echo c > c
173 176 $ hg add c
174 177 $ hg commit -m 2
175 178 created new head
176 179
177 180 bookmarks X moved to rev 2, Y at rev -1, Z at rev 0
178 181
179 182 $ hg bookmarks
180 183 * X 2:db815d6d32e6
181 184 X2 1:925d80f479bb
182 185 Y -1:000000000000
183 186 Z 0:f7b1eb17ad24
184 187
185 188 rename nonexistent bookmark
186 189
187 190 $ hg bookmark -m A B
188 191 abort: bookmark 'A' does not exist
189 192 [255]
190 193
191 194 rename to existent bookmark
192 195
193 196 $ hg bookmark -m X Y
194 197 abort: bookmark 'Y' already exists (use -f to force)
195 198 [255]
196 199
197 200 force rename to existent bookmark
198 201
199 202 $ hg bookmark -f -m X Y
200 203
201 204 rename bookmark using .
202 205
203 206 $ hg book rename-me
204 207 $ hg book -m . renamed --config "$TESTHOOK"
205 208 test-hook-bookmark: rename-me: db815d6d32e69058eadefc8cffbad37675707975 ->
206 209 test-hook-bookmark: renamed: -> db815d6d32e69058eadefc8cffbad37675707975
207 210 $ hg bookmark
208 211 X2 1:925d80f479bb
209 212 Y 2:db815d6d32e6
210 213 Z 0:f7b1eb17ad24
211 214 * renamed 2:db815d6d32e6
212 215 $ hg up -q Y
213 216 $ hg book -d renamed --config "$TESTHOOK"
214 217 test-hook-bookmark: renamed: db815d6d32e69058eadefc8cffbad37675707975 ->
215 218
216 219 rename bookmark using . with no active bookmark
217 220
218 221 $ hg book rename-me
219 222 $ hg book -i rename-me
220 223 $ hg book -m . renamed
221 224 abort: no active bookmark
222 225 [255]
223 226 $ hg up -q Y
224 227 $ hg book -d rename-me
225 228
226 229 delete bookmark using .
227 230
228 231 $ hg book delete-me
229 232 $ hg book -d .
230 233 $ hg bookmark
231 234 X2 1:925d80f479bb
232 235 Y 2:db815d6d32e6
233 236 Z 0:f7b1eb17ad24
234 237 $ hg up -q Y
235 238
236 239 delete bookmark using . with no active bookmark
237 240
238 241 $ hg book delete-me
239 242 $ hg book -i delete-me
240 243 $ hg book -d .
241 244 abort: no active bookmark
242 245 [255]
243 246 $ hg up -q Y
244 247 $ hg book -d delete-me
245 248
246 249 list bookmarks
247 250
248 251 $ hg bookmark
249 252 X2 1:925d80f479bb
250 253 * Y 2:db815d6d32e6
251 254 Z 0:f7b1eb17ad24
252 255
253 256 bookmarks from a revset
254 257 $ hg bookmark -r '.^1' REVSET
255 258 $ hg bookmark -r ':tip' TIP
256 259 $ hg up -q TIP
257 260 $ hg bookmarks
258 261 REVSET 0:f7b1eb17ad24
259 262 * TIP 2:db815d6d32e6
260 263 X2 1:925d80f479bb
261 264 Y 2:db815d6d32e6
262 265 Z 0:f7b1eb17ad24
263 266
264 267 $ hg bookmark -d REVSET
265 268 $ hg bookmark -d TIP
266 269
267 270 rename without new name or multiple names
268 271
269 272 $ hg bookmark -m Y
270 273 abort: new bookmark name required
271 274 [255]
272 275 $ hg bookmark -m Y Y2 Y3
273 276 abort: only one new bookmark name allowed
274 277 [255]
275 278
276 279 delete without name
277 280
278 281 $ hg bookmark -d
279 282 abort: bookmark name required
280 283 [255]
281 284
282 285 delete nonexistent bookmark
283 286
284 287 $ hg bookmark -d A
285 288 abort: bookmark 'A' does not exist
286 289 [255]
287 290
288 291 bookmark name with spaces should be stripped
289 292
290 293 $ hg bookmark ' x y '
291 294
292 295 list bookmarks
293 296
294 297 $ hg bookmarks
295 298 X2 1:925d80f479bb
296 299 Y 2:db815d6d32e6
297 300 Z 0:f7b1eb17ad24
298 301 * x y 2:db815d6d32e6
299 302
300 303 look up stripped bookmark name
301 304
302 305 $ hg log -r '"x y"'
303 306 changeset: 2:db815d6d32e6
304 307 bookmark: Y
305 308 bookmark: x y
306 309 tag: tip
307 310 parent: 0:f7b1eb17ad24
308 311 user: test
309 312 date: Thu Jan 01 00:00:00 1970 +0000
310 313 summary: 2
311 314
312 315
313 316 reject bookmark name with newline
314 317
315 318 $ hg bookmark '
316 319 > '
317 320 abort: bookmark names cannot consist entirely of whitespace
318 321 [255]
319 322
320 323 $ hg bookmark -m Z '
321 324 > '
322 325 abort: bookmark names cannot consist entirely of whitespace
323 326 [255]
324 327
325 328 bookmark with reserved name
326 329
327 330 $ hg bookmark tip
328 331 abort: the name 'tip' is reserved
329 332 [255]
330 333
331 334 $ hg bookmark .
332 335 abort: the name '.' is reserved
333 336 [255]
334 337
335 338 $ hg bookmark null
336 339 abort: the name 'null' is reserved
337 340 [255]
338 341
339 342
340 343 bookmark with existing name
341 344
342 345 $ hg bookmark X2
343 346 abort: bookmark 'X2' already exists (use -f to force)
344 347 [255]
345 348
346 349 $ hg bookmark -m Y Z
347 350 abort: bookmark 'Z' already exists (use -f to force)
348 351 [255]
349 352
350 353 bookmark with name of branch
351 354
352 355 $ hg bookmark default
353 356 abort: a bookmark cannot have the name of an existing branch
354 357 [255]
355 358
356 359 $ hg bookmark -m Y default
357 360 abort: a bookmark cannot have the name of an existing branch
358 361 [255]
359 362
360 363 bookmark with integer name
361 364
362 365 $ hg bookmark 10
363 366 abort: cannot use an integer as a name
364 367 [255]
365 368
366 369 bookmark with a name that matches a node id
367 370 $ hg bookmark 925d80f479bb db815d6d32e6 --config "$TESTHOOK"
368 371 bookmark 925d80f479bb matches a changeset hash
369 372 (did you leave a -r out of an 'hg bookmark' command?)
370 373 bookmark db815d6d32e6 matches a changeset hash
371 374 (did you leave a -r out of an 'hg bookmark' command?)
372 375 test-hook-bookmark: 925d80f479bb: -> db815d6d32e69058eadefc8cffbad37675707975
373 376 test-hook-bookmark: db815d6d32e6: -> db815d6d32e69058eadefc8cffbad37675707975
374 377 $ hg bookmark -d 925d80f479bb
375 378 $ hg bookmark -d db815d6d32e6
376 379
377 380 $ cd ..
378 381
379 382 bookmark with a name that matches an ambiguous node id
380 383
381 384 $ hg init ambiguous
382 385 $ cd ambiguous
383 386 $ echo 0 > a
384 387 $ hg ci -qAm 0
385 388 $ for i in 1057 2857 4025; do
386 389 > hg up -q 0
387 390 > echo $i > a
388 391 > hg ci -qm $i
389 392 > done
390 393 $ hg up -q null
391 394 $ hg log -r0: -T '{rev}:{node}\n'
392 395 0:b4e73ffab476aa0ee32ed81ca51e07169844bc6a
393 396 1:c56256a09cd28e5764f32e8e2810d0f01e2e357a
394 397 2:c5623987d205cd6d9d8389bfc40fff9dbb670b48
395 398 3:c562ddd9c94164376c20b86b0b4991636a3bf84f
396 399
397 400 $ hg bookmark -r0 c562
398 401 $ hg bookmarks
399 402 c562 0:b4e73ffab476
400 403
401 404 $ cd ..
402 405
403 406 incompatible options
404 407
405 408 $ cd repo
406 409
407 410 $ hg bookmark -m Y -d Z
408 411 abort: --delete and --rename are incompatible
409 412 [255]
410 413
411 414 $ hg bookmark -r 1 -d Z
412 415 abort: --rev is incompatible with --delete
413 416 [255]
414 417
415 418 $ hg bookmark -r 1 -m Z Y
416 419 abort: --rev is incompatible with --rename
417 420 [255]
418 421
419 422 force bookmark with existing name
420 423
421 424 $ hg bookmark -f X2 --config "$TESTHOOK"
422 425 test-hook-bookmark: X2: 925d80f479bb026b0fb3deb27503780b13f74123 -> db815d6d32e69058eadefc8cffbad37675707975
423 426
424 427 force bookmark back to where it was, should deactivate it
425 428
426 429 $ hg bookmark -fr1 X2
427 430 $ hg bookmarks
428 431 X2 1:925d80f479bb
429 432 Y 2:db815d6d32e6
430 433 Z 0:f7b1eb17ad24
431 434 x y 2:db815d6d32e6
432 435
433 436 forward bookmark to descendant without --force
434 437
435 438 $ hg bookmark Z
436 439 moving bookmark 'Z' forward from f7b1eb17ad24
437 440
438 441 list bookmarks
439 442
440 443 $ hg bookmark
441 444 X2 1:925d80f479bb
442 445 Y 2:db815d6d32e6
443 446 * Z 2:db815d6d32e6
444 447 x y 2:db815d6d32e6
445 448
446 449 revision but no bookmark name
447 450
448 451 $ hg bookmark -r .
449 452 abort: bookmark name required
450 453 [255]
451 454
452 455 bookmark name with whitespace only
453 456
454 457 $ hg bookmark ' '
455 458 abort: bookmark names cannot consist entirely of whitespace
456 459 [255]
457 460
458 461 $ hg bookmark -m Y ' '
459 462 abort: bookmark names cannot consist entirely of whitespace
460 463 [255]
461 464
462 465 invalid bookmark
463 466
464 467 $ hg bookmark 'foo:bar'
465 468 abort: ':' cannot be used in a name
466 469 [255]
467 470
468 471 $ hg bookmark 'foo
469 472 > bar'
470 473 abort: '\n' cannot be used in a name
471 474 [255]
472 475
473 476 the bookmark extension should be ignored now that it is part of core
474 477
475 478 $ echo "[extensions]" >> $HGRCPATH
476 479 $ echo "bookmarks=" >> $HGRCPATH
477 480 $ hg bookmarks
478 481 X2 1:925d80f479bb
479 482 Y 2:db815d6d32e6
480 483 * Z 2:db815d6d32e6
481 484 x y 2:db815d6d32e6
482 485
483 486 test summary
484 487
485 488 $ hg summary
486 489 parent: 2:db815d6d32e6 tip
487 490 2
488 491 branch: default
489 492 bookmarks: *Z Y x y
490 493 commit: (clean)
491 494 update: 1 new changesets, 2 branch heads (merge)
492 495 phases: 3 draft
493 496
494 497 test id
495 498
496 499 $ hg id
497 500 db815d6d32e6 tip Y/Z/x y
498 501
499 502 test rollback
500 503
501 504 $ echo foo > f1
502 505 $ hg bookmark tmp-rollback
503 506 $ hg ci -Amr
504 507 adding f1
505 508 $ hg bookmarks
506 509 X2 1:925d80f479bb
507 510 Y 2:db815d6d32e6
508 511 Z 2:db815d6d32e6
509 512 * tmp-rollback 3:2bf5cfec5864
510 513 x y 2:db815d6d32e6
511 514 $ hg rollback
512 515 repository tip rolled back to revision 2 (undo commit)
513 516 working directory now based on revision 2
514 517 $ hg bookmarks
515 518 X2 1:925d80f479bb
516 519 Y 2:db815d6d32e6
517 520 Z 2:db815d6d32e6
518 521 * tmp-rollback 2:db815d6d32e6
519 522 x y 2:db815d6d32e6
520 523 $ hg bookmark -f Z -r 1
521 524 $ hg rollback
522 525 repository tip rolled back to revision 2 (undo bookmark)
523 526 $ hg bookmarks
524 527 X2 1:925d80f479bb
525 528 Y 2:db815d6d32e6
526 529 Z 2:db815d6d32e6
527 530 * tmp-rollback 2:db815d6d32e6
528 531 x y 2:db815d6d32e6
529 532 $ hg bookmark -d tmp-rollback
530 533
531 534 activate bookmark on working dir parent without --force
532 535
533 536 $ hg bookmark --inactive Z
534 537 $ hg bookmark Z
535 538
536 539 test clone
537 540
538 541 $ hg bookmark -r 2 -i @
539 542 $ hg bookmark -r 2 -i a@
540 543 $ hg bookmarks
541 544 @ 2:db815d6d32e6
542 545 X2 1:925d80f479bb
543 546 Y 2:db815d6d32e6
544 547 * Z 2:db815d6d32e6
545 548 a@ 2:db815d6d32e6
546 549 x y 2:db815d6d32e6
547 550 $ hg clone . cloned-bookmarks
548 551 updating to bookmark @
549 552 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
550 553 $ hg -R cloned-bookmarks bookmarks
551 554 * @ 2:db815d6d32e6
552 555 X2 1:925d80f479bb
553 556 Y 2:db815d6d32e6
554 557 Z 2:db815d6d32e6
555 558 a@ 2:db815d6d32e6
556 559 x y 2:db815d6d32e6
557 560
558 561 test clone with pull protocol
559 562
560 563 $ hg clone --pull . cloned-bookmarks-pull
561 564 requesting all changes
562 565 adding changesets
563 566 adding manifests
564 567 adding file changes
565 568 added 3 changesets with 3 changes to 3 files (+1 heads)
566 569 new changesets f7b1eb17ad24:db815d6d32e6
567 570 updating to bookmark @
568 571 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
569 572 $ hg -R cloned-bookmarks-pull bookmarks
570 573 * @ 2:db815d6d32e6
571 574 X2 1:925d80f479bb
572 575 Y 2:db815d6d32e6
573 576 Z 2:db815d6d32e6
574 577 a@ 2:db815d6d32e6
575 578 x y 2:db815d6d32e6
576 579
577 580 delete multiple bookmarks at once
578 581
579 582 $ hg bookmark -d @ a@
580 583
581 584 test clone with a bookmark named "default" (issue3677)
582 585
583 586 $ hg bookmark -r 1 -f -i default
584 587 $ hg clone . cloned-bookmark-default
585 588 updating to branch default
586 589 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
587 590 $ hg -R cloned-bookmark-default bookmarks
588 591 X2 1:925d80f479bb
589 592 Y 2:db815d6d32e6
590 593 Z 2:db815d6d32e6
591 594 default 1:925d80f479bb
592 595 x y 2:db815d6d32e6
593 596 $ hg -R cloned-bookmark-default parents -q
594 597 2:db815d6d32e6
595 598 $ hg bookmark -d default
596 599
597 600 test clone with a specific revision
598 601
599 602 $ hg clone -r 925d80 . cloned-bookmarks-rev
600 603 adding changesets
601 604 adding manifests
602 605 adding file changes
603 606 added 2 changesets with 2 changes to 2 files
604 607 new changesets f7b1eb17ad24:925d80f479bb
605 608 updating to branch default
606 609 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
607 610 $ hg -R cloned-bookmarks-rev bookmarks
608 611 X2 1:925d80f479bb
609 612
610 613 test clone with update to a bookmark
611 614
612 615 $ hg clone -u Z . ../cloned-bookmarks-update
613 616 updating to branch default
614 617 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
615 618 $ hg -R ../cloned-bookmarks-update bookmarks
616 619 X2 1:925d80f479bb
617 620 Y 2:db815d6d32e6
618 621 * Z 2:db815d6d32e6
619 622 x y 2:db815d6d32e6
620 623
621 624 create bundle with two heads
622 625
623 626 $ hg clone . tobundle
624 627 updating to branch default
625 628 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
626 629 $ echo x > tobundle/x
627 630 $ hg -R tobundle add tobundle/x
628 631 $ hg -R tobundle commit -m'x'
629 632 $ hg -R tobundle update -r -2
630 633 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
631 634 $ echo y > tobundle/y
632 635 $ hg -R tobundle branch test
633 636 marked working directory as branch test
634 637 (branches are permanent and global, did you want a bookmark?)
635 638 $ hg -R tobundle add tobundle/y
636 639 $ hg -R tobundle commit -m'y'
637 640 $ hg -R tobundle bundle tobundle.hg
638 641 searching for changes
639 642 2 changesets found
640 643 $ hg unbundle tobundle.hg
641 644 adding changesets
642 645 adding manifests
643 646 adding file changes
644 647 added 2 changesets with 2 changes to 2 files (+1 heads)
645 648 new changesets 125c9a1d6df6:9ba5f110a0b3
646 649 (run 'hg heads' to see heads, 'hg merge' to merge)
647 650
648 651 update to active bookmark if it's not the parent
649 652
650 653 (it is known issue that fsmonitor can't handle nested repositories. In
651 654 this test scenario, cloned-bookmark-default and tobundle exist in the
652 655 working directory of current repository)
653 656
654 657 $ hg summary
655 658 parent: 2:db815d6d32e6
656 659 2
657 660 branch: default
658 661 bookmarks: *Z Y x y
659 662 commit: 1 added, 1 unknown (new branch head) (no-fsmonitor !)
660 663 commit: 1 added, * unknown (new branch head) (glob) (fsmonitor !)
661 664 update: 2 new changesets (update)
662 665 phases: 5 draft
663 666 $ hg update
664 667 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
665 668 updating bookmark Z
666 669 $ hg bookmarks
667 670 X2 1:925d80f479bb
668 671 Y 2:db815d6d32e6
669 672 * Z 3:125c9a1d6df6
670 673 x y 2:db815d6d32e6
671 674
672 675 pull --update works the same as pull && update
673 676
674 677 $ hg bookmark -r3 Y
675 678 moving bookmark 'Y' forward from db815d6d32e6
676 679 $ cp -R ../cloned-bookmarks-update ../cloned-bookmarks-manual-update
677 680 $ cp -R ../cloned-bookmarks-update ../cloned-bookmarks-manual-update-with-divergence
678 681
679 682 (manual version)
680 683
681 684 $ hg -R ../cloned-bookmarks-manual-update update Y
682 685 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
683 686 (activating bookmark Y)
684 687 $ hg -R ../cloned-bookmarks-manual-update pull .
685 688 pulling from .
686 689 searching for changes
687 690 adding changesets
688 691 adding manifests
689 692 adding file changes
690 693 added 2 changesets with 2 changes to 2 files (+1 heads)
691 694 updating bookmark Y
692 695 updating bookmark Z
693 696 new changesets 125c9a1d6df6:9ba5f110a0b3
694 697 (run 'hg heads' to see heads, 'hg merge' to merge)
695 698
696 699 (# tests strange but with --date crashing when bookmark have to move)
697 700
698 701 $ hg -R ../cloned-bookmarks-manual-update update -d 1986
699 702 abort: revision matching date not found
700 703 [255]
701 704 $ hg -R ../cloned-bookmarks-manual-update update
702 705 updating to active bookmark Y
703 706 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
704 707
705 708 (all in one version)
706 709
707 710 $ hg -R ../cloned-bookmarks-update update Y
708 711 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
709 712 (activating bookmark Y)
710 713 $ hg -R ../cloned-bookmarks-update pull --update .
711 714 pulling from .
712 715 searching for changes
713 716 adding changesets
714 717 adding manifests
715 718 adding file changes
716 719 added 2 changesets with 2 changes to 2 files (+1 heads)
717 720 updating bookmark Y
718 721 updating bookmark Z
719 722 new changesets 125c9a1d6df6:9ba5f110a0b3
720 723 updating to active bookmark Y
721 724 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
722 725
723 726 We warn about divergent during bare update to the active bookmark
724 727
725 728 $ hg -R ../cloned-bookmarks-manual-update-with-divergence update Y
726 729 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
727 730 (activating bookmark Y)
728 731 $ hg -R ../cloned-bookmarks-manual-update-with-divergence bookmarks -r X2 Y@1
729 732 $ hg -R ../cloned-bookmarks-manual-update-with-divergence bookmarks
730 733 X2 1:925d80f479bb
731 734 * Y 2:db815d6d32e6
732 735 Y@1 1:925d80f479bb
733 736 Z 2:db815d6d32e6
734 737 x y 2:db815d6d32e6
735 738 $ hg -R ../cloned-bookmarks-manual-update-with-divergence pull
736 739 pulling from $TESTTMP/repo (glob)
737 740 searching for changes
738 741 adding changesets
739 742 adding manifests
740 743 adding file changes
741 744 added 2 changesets with 2 changes to 2 files (+1 heads)
742 745 updating bookmark Y
743 746 updating bookmark Z
744 747 new changesets 125c9a1d6df6:9ba5f110a0b3
745 748 (run 'hg heads' to see heads, 'hg merge' to merge)
746 749 $ hg -R ../cloned-bookmarks-manual-update-with-divergence update
747 750 updating to active bookmark Y
748 751 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
749 752 1 other divergent bookmarks for "Y"
750 753
751 754 test wrongly formated bookmark
752 755
753 756 $ echo '' >> .hg/bookmarks
754 757 $ hg bookmarks
755 758 X2 1:925d80f479bb
756 759 Y 3:125c9a1d6df6
757 760 * Z 3:125c9a1d6df6
758 761 x y 2:db815d6d32e6
759 762 $ echo "Ican'thasformatedlines" >> .hg/bookmarks
760 763 $ hg bookmarks
761 764 malformed line in .hg/bookmarks: "Ican'thasformatedlines"
762 765 X2 1:925d80f479bb
763 766 Y 3:125c9a1d6df6
764 767 * Z 3:125c9a1d6df6
765 768 x y 2:db815d6d32e6
766 769
767 770 test missing revisions
768 771
769 772 $ echo "925d80f479b925d80f479bc925d80f479bccabab z" > .hg/bookmarks
770 773 $ hg book
771 774 no bookmarks set
772 775
773 776 test stripping a non-checked-out but bookmarked revision
774 777
775 778 $ hg log --graph
776 779 o changeset: 4:9ba5f110a0b3
777 780 | branch: test
778 781 | tag: tip
779 782 | parent: 2:db815d6d32e6
780 783 | user: test
781 784 | date: Thu Jan 01 00:00:00 1970 +0000
782 785 | summary: y
783 786 |
784 787 | @ changeset: 3:125c9a1d6df6
785 788 |/ user: test
786 789 | date: Thu Jan 01 00:00:00 1970 +0000
787 790 | summary: x
788 791 |
789 792 o changeset: 2:db815d6d32e6
790 793 | parent: 0:f7b1eb17ad24
791 794 | user: test
792 795 | date: Thu Jan 01 00:00:00 1970 +0000
793 796 | summary: 2
794 797 |
795 798 | o changeset: 1:925d80f479bb
796 799 |/ user: test
797 800 | date: Thu Jan 01 00:00:00 1970 +0000
798 801 | summary: 1
799 802 |
800 803 o changeset: 0:f7b1eb17ad24
801 804 user: test
802 805 date: Thu Jan 01 00:00:00 1970 +0000
803 806 summary: 0
804 807
805 808 $ hg book should-end-on-two
806 809 $ hg co --clean 4
807 810 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
808 811 (leaving bookmark should-end-on-two)
809 812 $ hg book four
810 813 $ hg --config extensions.mq= strip 3
811 814 saved backup bundle to * (glob)
812 815 should-end-on-two should end up pointing to revision 2, as that's the
813 816 tipmost surviving ancestor of the stripped revision.
814 817 $ hg log --graph
815 818 @ changeset: 3:9ba5f110a0b3
816 819 | branch: test
817 820 | bookmark: four
818 821 | tag: tip
819 822 | user: test
820 823 | date: Thu Jan 01 00:00:00 1970 +0000
821 824 | summary: y
822 825 |
823 826 o changeset: 2:db815d6d32e6
824 827 | bookmark: should-end-on-two
825 828 | parent: 0:f7b1eb17ad24
826 829 | user: test
827 830 | date: Thu Jan 01 00:00:00 1970 +0000
828 831 | summary: 2
829 832 |
830 833 | o changeset: 1:925d80f479bb
831 834 |/ user: test
832 835 | date: Thu Jan 01 00:00:00 1970 +0000
833 836 | summary: 1
834 837 |
835 838 o changeset: 0:f7b1eb17ad24
836 839 user: test
837 840 date: Thu Jan 01 00:00:00 1970 +0000
838 841 summary: 0
839 842
840 843
841 844 no-op update doesn't deactivate bookmarks
842 845
843 846 (it is known issue that fsmonitor can't handle nested repositories. In
844 847 this test scenario, cloned-bookmark-default and tobundle exist in the
845 848 working directory of current repository)
846 849
847 850 $ hg bookmarks
848 851 * four 3:9ba5f110a0b3
849 852 should-end-on-two 2:db815d6d32e6
850 853 $ hg up four
851 854 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
852 855 $ hg up
853 856 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
854 857 $ hg sum
855 858 parent: 3:9ba5f110a0b3 tip
856 859 y
857 860 branch: test
858 861 bookmarks: *four
859 862 commit: 2 unknown (clean) (no-fsmonitor !)
860 863 commit: * unknown (clean) (glob) (fsmonitor !)
861 864 update: (current)
862 865 phases: 4 draft
863 866
864 867 test clearing divergent bookmarks of linear ancestors
865 868
866 869 $ hg bookmark Z -r 0
867 870 $ hg bookmark Z@1 -r 1
868 871 $ hg bookmark Z@2 -r 2
869 872 $ hg bookmark Z@3 -r 3
870 873 $ hg book
871 874 Z 0:f7b1eb17ad24
872 875 Z@1 1:925d80f479bb
873 876 Z@2 2:db815d6d32e6
874 877 Z@3 3:9ba5f110a0b3
875 878 * four 3:9ba5f110a0b3
876 879 should-end-on-two 2:db815d6d32e6
877 880 $ hg bookmark Z
878 881 moving bookmark 'Z' forward from f7b1eb17ad24
879 882 $ hg book
880 883 * Z 3:9ba5f110a0b3
881 884 Z@1 1:925d80f479bb
882 885 four 3:9ba5f110a0b3
883 886 should-end-on-two 2:db815d6d32e6
884 887
885 888 test clearing only a single divergent bookmark across branches
886 889
887 890 $ hg book foo -r 1
888 891 $ hg book foo@1 -r 0
889 892 $ hg book foo@2 -r 2
890 893 $ hg book foo@3 -r 3
891 894 $ hg book foo -r foo@3
892 895 $ hg book
893 896 * Z 3:9ba5f110a0b3
894 897 Z@1 1:925d80f479bb
895 898 foo 3:9ba5f110a0b3
896 899 foo@1 0:f7b1eb17ad24
897 900 foo@2 2:db815d6d32e6
898 901 four 3:9ba5f110a0b3
899 902 should-end-on-two 2:db815d6d32e6
900 903
901 904 pull --update works the same as pull && update (case #2)
902 905
903 906 It is assumed that "hg pull" itself doesn't update current active
904 907 bookmark ('Y' in tests below).
905 908
906 909 $ hg pull -q ../cloned-bookmarks-update
907 910 divergent bookmark Z stored as Z@2
908 911
909 912 (pulling revision on another named branch with --update updates
910 913 neither the working directory nor current active bookmark: "no-op"
911 914 case)
912 915
913 916 $ echo yy >> y
914 917 $ hg commit -m yy
915 918
916 919 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
917 920 * Y 3:125c9a1d6df6
918 921 $ hg -R ../cloned-bookmarks-update pull . --update
919 922 pulling from .
920 923 searching for changes
921 924 adding changesets
922 925 adding manifests
923 926 adding file changes
924 927 added 1 changesets with 1 changes to 1 files
925 928 divergent bookmark Z stored as Z@default
926 929 adding remote bookmark foo
927 930 adding remote bookmark four
928 931 adding remote bookmark should-end-on-two
929 932 new changesets 5fb12f0f2d51
930 933 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
931 934 $ hg -R ../cloned-bookmarks-update parents -T "{rev}:{node|short}\n"
932 935 3:125c9a1d6df6
933 936 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
934 937 * Y 3:125c9a1d6df6
935 938
936 939 (pulling revision on current named/topological branch with --update
937 940 updates the working directory and current active bookmark)
938 941
939 942 $ hg update -C -q 125c9a1d6df6
940 943 $ echo xx >> x
941 944 $ hg commit -m xx
942 945
943 946 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
944 947 * Y 3:125c9a1d6df6
945 948 $ hg -R ../cloned-bookmarks-update pull . --update
946 949 pulling from .
947 950 searching for changes
948 951 adding changesets
949 952 adding manifests
950 953 adding file changes
951 954 added 1 changesets with 1 changes to 1 files
952 955 divergent bookmark Z stored as Z@default
953 956 new changesets 81dcce76aa0b
954 957 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
955 958 updating bookmark Y
956 959 $ hg -R ../cloned-bookmarks-update parents -T "{rev}:{node|short}\n"
957 960 6:81dcce76aa0b
958 961 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
959 962 * Y 6:81dcce76aa0b
960 963
961 964 $ cd ..
962 965
963 966 ensure changelog is written before bookmarks
964 967 $ hg init orderrepo
965 968 $ cd orderrepo
966 969 $ touch a
967 970 $ hg commit -Aqm one
968 971 $ hg book mybook
969 972 $ echo a > a
970 973
971 974 $ cat > $TESTTMP/pausefinalize.py <<EOF
972 975 > from __future__ import absolute_import
973 976 > import os
974 977 > import time
975 978 > from mercurial import extensions, localrepo
976 979 > def transaction(orig, self, desc, report=None):
977 980 > tr = orig(self, desc, report)
978 981 > def sleep(*args, **kwargs):
979 982 > retry = 20
980 983 > while retry > 0 and not os.path.exists("$TESTTMP/unpause"):
981 984 > retry -= 1
982 985 > time.sleep(0.5)
983 986 > if os.path.exists("$TESTTMP/unpause"):
984 987 > os.remove("$TESTTMP/unpause")
985 988 > # It is important that this finalizer start with 'a', so it runs before
986 989 > # the changelog finalizer appends to the changelog.
987 990 > tr.addfinalize('a-sleep', sleep)
988 991 > return tr
989 992 >
990 993 > def extsetup(ui):
991 994 > # This extension inserts an artifical pause during the transaction
992 995 > # finalizer, so we can run commands mid-transaction-close.
993 996 > extensions.wrapfunction(localrepo.localrepository, 'transaction',
994 997 > transaction)
995 998 > EOF
996 999 $ hg commit -qm two --config extensions.pausefinalize=$TESTTMP/pausefinalize.py &
997 1000 $ sleep 2
998 1001 $ hg log -r .
999 1002 changeset: 0:867bc5792c8c
1000 1003 bookmark: mybook
1001 1004 tag: tip
1002 1005 user: test
1003 1006 date: Thu Jan 01 00:00:00 1970 +0000
1004 1007 summary: one
1005 1008
1006 1009 $ hg bookmarks
1007 1010 * mybook 0:867bc5792c8c
1008 1011 $ touch $TESTTMP/unpause
1009 1012
1010 1013 $ cd ..
1011 1014
1012 1015 check whether HG_PENDING makes pending changes only in related
1013 1016 repositories visible to an external hook.
1014 1017
1015 1018 (emulate a transaction running concurrently by copied
1016 1019 .hg/bookmarks.pending in subsequent test)
1017 1020
1018 1021 $ cat > $TESTTMP/savepending.sh <<EOF
1019 1022 > cp .hg/bookmarks.pending .hg/bookmarks.pending.saved
1020 1023 > exit 1 # to avoid adding new bookmark for subsequent tests
1021 1024 > EOF
1022 1025
1023 1026 $ hg init unrelated
1024 1027 $ cd unrelated
1025 1028 $ echo a > a
1026 1029 $ hg add a
1027 1030 $ hg commit -m '#0'
1028 1031 $ hg --config hooks.pretxnclose="sh $TESTTMP/savepending.sh" bookmarks INVISIBLE
1029 1032 transaction abort!
1030 1033 rollback completed
1031 1034 abort: pretxnclose hook exited with status 1
1032 1035 [255]
1033 1036 $ cp .hg/bookmarks.pending.saved .hg/bookmarks.pending
1034 1037
1035 1038 (check visible bookmarks while transaction running in repo)
1036 1039
1037 1040 $ cat > $TESTTMP/checkpending.sh <<EOF
1038 1041 > echo "@repo"
1039 1042 > hg -R "$TESTTMP/repo" bookmarks
1040 1043 > echo "@unrelated"
1041 1044 > hg -R "$TESTTMP/unrelated" bookmarks
1042 1045 > exit 1 # to avoid adding new bookmark for subsequent tests
1043 1046 > EOF
1044 1047
1045 1048 $ cd ../repo
1046 1049 $ hg --config hooks.pretxnclose="sh $TESTTMP/checkpending.sh" bookmarks NEW
1047 1050 @repo
1048 1051 * NEW 6:81dcce76aa0b
1049 1052 X2 1:925d80f479bb
1050 1053 Y 4:125c9a1d6df6
1051 1054 Z 5:5fb12f0f2d51
1052 1055 Z@1 1:925d80f479bb
1053 1056 Z@2 4:125c9a1d6df6
1054 1057 foo 3:9ba5f110a0b3
1055 1058 foo@1 0:f7b1eb17ad24
1056 1059 foo@2 2:db815d6d32e6
1057 1060 four 3:9ba5f110a0b3
1058 1061 should-end-on-two 2:db815d6d32e6
1059 1062 x y 2:db815d6d32e6
1060 1063 @unrelated
1061 1064 no bookmarks set
1062 1065 transaction abort!
1063 1066 rollback completed
1064 1067 abort: pretxnclose hook exited with status 1
1065 1068 [255]
1066 1069
1067 1070 Check pretxnclose-bookmark can abort a transaction
1068 1071 --------------------------------------------------
1069 1072
1070 1073 add hooks:
1071 1074
1072 1075 * to prevent NEW bookmark on a non-public changeset
1073 1076 * to prevent non-forward move of NEW bookmark
1074 1077
1075 1078 $ cat << EOF >> .hg/hgrc
1076 1079 > [hooks]
1077 > pretxnclose-bookmark.force-public = (echo \$HG_BOOKMARK| grep -v NEW > /dev/null) || [ -z "\$HG_NODE" ] || (hg log -r "\$HG_NODE" -T '{phase}' | grep public > /dev/null)
1078 > pretxnclose-bookmark.force-forward = (echo \$HG_BOOKMARK| grep -v NEW > /dev/null) || [ -z "\$HG_NODE" ] || (hg log -r "max(\$HG_OLDNODE::\$HG_NODE)" -T 'MATCH' | grep MATCH > /dev/null)
1080 > pretxnclose-bookmark.force-public = sh -c "(echo \$HG_BOOKMARK| grep -v NEW > /dev/null) || [ -z \"\$HG_NODE\" ] || (hg log -r \"\$HG_NODE\" -T '{phase}' | grep public > /dev/null)"
1081 > pretxnclose-bookmark.force-forward = sh -c "(echo \$HG_BOOKMARK| grep -v NEW > /dev/null) || [ -z \"\$HG_NODE\" ] || (hg log -r \"max(\$HG_OLDNODE::\$HG_NODE)\" -T 'MATCH' | grep MATCH > /dev/null)"
1079 1082 > EOF
1080 1083
1081 1084 $ hg log -G -T phases
1082 1085 @ changeset: 6:81dcce76aa0b
1083 1086 | tag: tip
1084 1087 | phase: draft
1085 1088 | parent: 4:125c9a1d6df6
1086 1089 | user: test
1087 1090 | date: Thu Jan 01 00:00:00 1970 +0000
1088 1091 | summary: xx
1089 1092 |
1090 1093 | o changeset: 5:5fb12f0f2d51
1091 1094 | | branch: test
1092 1095 | | bookmark: Z
1093 1096 | | phase: draft
1094 1097 | | parent: 3:9ba5f110a0b3
1095 1098 | | user: test
1096 1099 | | date: Thu Jan 01 00:00:00 1970 +0000
1097 1100 | | summary: yy
1098 1101 | |
1099 1102 o | changeset: 4:125c9a1d6df6
1100 1103 | | bookmark: Y
1101 1104 | | bookmark: Z@2
1102 1105 | | phase: public
1103 1106 | | parent: 2:db815d6d32e6
1104 1107 | | user: test
1105 1108 | | date: Thu Jan 01 00:00:00 1970 +0000
1106 1109 | | summary: x
1107 1110 | |
1108 1111 | o changeset: 3:9ba5f110a0b3
1109 1112 |/ branch: test
1110 1113 | bookmark: foo
1111 1114 | bookmark: four
1112 1115 | phase: public
1113 1116 | user: test
1114 1117 | date: Thu Jan 01 00:00:00 1970 +0000
1115 1118 | summary: y
1116 1119 |
1117 1120 o changeset: 2:db815d6d32e6
1118 1121 | bookmark: foo@2
1119 1122 | bookmark: should-end-on-two
1120 1123 | bookmark: x y
1121 1124 | phase: public
1122 1125 | parent: 0:f7b1eb17ad24
1123 1126 | user: test
1124 1127 | date: Thu Jan 01 00:00:00 1970 +0000
1125 1128 | summary: 2
1126 1129 |
1127 1130 | o changeset: 1:925d80f479bb
1128 1131 |/ bookmark: X2
1129 1132 | bookmark: Z@1
1130 1133 | phase: public
1131 1134 | user: test
1132 1135 | date: Thu Jan 01 00:00:00 1970 +0000
1133 1136 | summary: 1
1134 1137 |
1135 1138 o changeset: 0:f7b1eb17ad24
1136 1139 bookmark: foo@1
1137 1140 phase: public
1138 1141 user: test
1139 1142 date: Thu Jan 01 00:00:00 1970 +0000
1140 1143 summary: 0
1141 1144
1142 1145
1143 1146 attempt to create on a default changeset
1144 1147
1145 1148 $ hg bookmark -r 81dcce76aa0b NEW
1146 1149 transaction abort!
1147 1150 rollback completed
1148 1151 abort: pretxnclose-bookmark.force-public hook exited with status 1
1149 1152 [255]
1150 1153
1151 1154 create on a public changeset
1152 1155
1153 1156 $ hg bookmark -r 9ba5f110a0b3 NEW
1154 1157
1155 1158 move to the other branch
1156 1159
1157 1160 $ hg bookmark -f -r 125c9a1d6df6 NEW
1158 1161 transaction abort!
1159 1162 rollback completed
1160 1163 abort: pretxnclose-bookmark.force-forward hook exited with status 1
1161 1164 [255]
@@ -1,825 +1,828 b''
1 $ cat > $TESTTMP/hook.sh << 'EOF'
2 > echo "test-hook-close-phase: $HG_NODE: $HG_OLDPHASE -> $HG_PHASE"
3 > EOF
1 4
2 5 $ cat >> $HGRCPATH << EOF
3 6 > [extensions]
4 7 > phasereport=$TESTDIR/testlib/ext-phase-report.py
5 8 > [hooks]
6 > txnclose-phase.test = echo "test-hook-close-phase: \$HG_NODE: \$HG_OLDPHASE -> \$HG_PHASE"
9 > txnclose-phase.test = sh $TESTTMP/hook.sh
7 10 > EOF
8 11
9 12 $ hglog() { hg log --template "{rev} {phaseidx} {desc}\n" $*; }
10 13 $ mkcommit() {
11 14 > echo "$1" > "$1"
12 15 > hg add "$1"
13 16 > message="$1"
14 17 > shift
15 18 > hg ci -m "$message" $*
16 19 > }
17 20
18 21 $ hg init initialrepo
19 22 $ cd initialrepo
20 23
21 24 Cannot change null revision phase
22 25
23 26 $ hg phase --force --secret null
24 27 abort: cannot change null revision phase
25 28 [255]
26 29 $ hg phase null
27 30 -1: public
28 31
29 32 $ mkcommit A
30 33 test-debug-phase: new rev 0: x -> 1
31 34 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: -> draft
32 35
33 36 New commit are draft by default
34 37
35 38 $ hglog
36 39 0 1 A
37 40
38 41 Following commit are draft too
39 42
40 43 $ mkcommit B
41 44 test-debug-phase: new rev 1: x -> 1
42 45 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: -> draft
43 46
44 47 $ hglog
45 48 1 1 B
46 49 0 1 A
47 50
48 51 Draft commit are properly created over public one:
49 52
50 53 $ hg phase --public .
51 54 test-debug-phase: move rev 0: 1 -> 0
52 55 test-debug-phase: move rev 1: 1 -> 0
53 56 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: draft -> public
54 57 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: draft -> public
55 58 $ hg phase
56 59 1: public
57 60 $ hglog
58 61 1 0 B
59 62 0 0 A
60 63
61 64 $ mkcommit C
62 65 test-debug-phase: new rev 2: x -> 1
63 66 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: -> draft
64 67 $ mkcommit D
65 68 test-debug-phase: new rev 3: x -> 1
66 69 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: -> draft
67 70
68 71 $ hglog
69 72 3 1 D
70 73 2 1 C
71 74 1 0 B
72 75 0 0 A
73 76
74 77 Test creating changeset as secret
75 78
76 79 $ mkcommit E --config phases.new-commit='secret'
77 80 test-debug-phase: new rev 4: x -> 2
78 81 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: -> secret
79 82 $ hglog
80 83 4 2 E
81 84 3 1 D
82 85 2 1 C
83 86 1 0 B
84 87 0 0 A
85 88
86 89 Test the secret property is inherited
87 90
88 91 $ mkcommit H
89 92 test-debug-phase: new rev 5: x -> 2
90 93 test-hook-close-phase: a030c6be5127abc010fcbff1851536552e6951a8: -> secret
91 94 $ hglog
92 95 5 2 H
93 96 4 2 E
94 97 3 1 D
95 98 2 1 C
96 99 1 0 B
97 100 0 0 A
98 101
99 102 Even on merge
100 103
101 104 $ hg up -q 1
102 105 $ mkcommit "B'"
103 106 test-debug-phase: new rev 6: x -> 1
104 107 created new head
105 108 test-hook-close-phase: cf9fe039dfd67e829edf6522a45de057b5c86519: -> draft
106 109 $ hglog
107 110 6 1 B'
108 111 5 2 H
109 112 4 2 E
110 113 3 1 D
111 114 2 1 C
112 115 1 0 B
113 116 0 0 A
114 117 $ hg merge 4 # E
115 118 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
116 119 (branch merge, don't forget to commit)
117 120 $ hg phase
118 121 6: draft
119 122 4: secret
120 123 $ hg ci -m "merge B' and E"
121 124 test-debug-phase: new rev 7: x -> 2
122 125 test-hook-close-phase: 17a481b3bccb796c0521ae97903d81c52bfee4af: -> secret
123 126
124 127 $ hglog
125 128 7 2 merge B' and E
126 129 6 1 B'
127 130 5 2 H
128 131 4 2 E
129 132 3 1 D
130 133 2 1 C
131 134 1 0 B
132 135 0 0 A
133 136
134 137 Test secret changeset are not pushed
135 138
136 139 $ hg init ../push-dest
137 140 $ cat > ../push-dest/.hg/hgrc << EOF
138 141 > [phases]
139 142 > publish=False
140 143 > EOF
141 144 $ hg outgoing ../push-dest --template='{rev} {phase} {desc|firstline}\n'
142 145 comparing with ../push-dest
143 146 searching for changes
144 147 0 public A
145 148 1 public B
146 149 2 draft C
147 150 3 draft D
148 151 6 draft B'
149 152 $ hg outgoing -r 'branch(default)' ../push-dest --template='{rev} {phase} {desc|firstline}\n'
150 153 comparing with ../push-dest
151 154 searching for changes
152 155 0 public A
153 156 1 public B
154 157 2 draft C
155 158 3 draft D
156 159 6 draft B'
157 160
158 161 $ hg push ../push-dest -f # force because we push multiple heads
159 162 pushing to ../push-dest
160 163 searching for changes
161 164 adding changesets
162 165 adding manifests
163 166 adding file changes
164 167 added 5 changesets with 5 changes to 5 files (+1 heads)
165 168 test-debug-phase: new rev 0: x -> 0
166 169 test-debug-phase: new rev 1: x -> 0
167 170 test-debug-phase: new rev 2: x -> 1
168 171 test-debug-phase: new rev 3: x -> 1
169 172 test-debug-phase: new rev 4: x -> 1
170 173 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: -> public
171 174 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: -> public
172 175 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: -> draft
173 176 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: -> draft
174 177 test-hook-close-phase: cf9fe039dfd67e829edf6522a45de057b5c86519: -> draft
175 178 $ hglog
176 179 7 2 merge B' and E
177 180 6 1 B'
178 181 5 2 H
179 182 4 2 E
180 183 3 1 D
181 184 2 1 C
182 185 1 0 B
183 186 0 0 A
184 187 $ cd ../push-dest
185 188 $ hglog
186 189 4 1 B'
187 190 3 1 D
188 191 2 1 C
189 192 1 0 B
190 193 0 0 A
191 194
192 195 (Issue3303)
193 196 Check that remote secret changeset are ignore when checking creation of remote heads
194 197
195 198 We add a secret head into the push destination. This secret head shadows a
196 199 visible shared between the initial repo and the push destination.
197 200
198 201 $ hg up -q 4 # B'
199 202 $ mkcommit Z --config phases.new-commit=secret
200 203 test-debug-phase: new rev 5: x -> 2
201 204 test-hook-close-phase: 2713879da13d6eea1ff22b442a5a87cb31a7ce6a: -> secret
202 205 $ hg phase .
203 206 5: secret
204 207
205 208 We now try to push a new public changeset that descend from the common public
206 209 head shadowed by the remote secret head.
207 210
208 211 $ cd ../initialrepo
209 212 $ hg up -q 6 #B'
210 213 $ mkcommit I
211 214 test-debug-phase: new rev 8: x -> 1
212 215 created new head
213 216 test-hook-close-phase: 6d6770faffce199f1fddd1cf87f6f026138cf061: -> draft
214 217 $ hg push ../push-dest
215 218 pushing to ../push-dest
216 219 searching for changes
217 220 adding changesets
218 221 adding manifests
219 222 adding file changes
220 223 added 1 changesets with 1 changes to 1 files (+1 heads)
221 224 test-debug-phase: new rev 6: x -> 1
222 225 test-hook-close-phase: 6d6770faffce199f1fddd1cf87f6f026138cf061: -> draft
223 226
224 227 :note: The "(+1 heads)" is wrong as we do not had any visible head
225 228
226 229 check that branch cache with "served" filter are properly computed and stored
227 230
228 231 $ ls ../push-dest/.hg/cache/branch2*
229 232 ../push-dest/.hg/cache/branch2-base
230 233 ../push-dest/.hg/cache/branch2-served
231 234 $ cat ../push-dest/.hg/cache/branch2-served
232 235 6d6770faffce199f1fddd1cf87f6f026138cf061 6 465891ffab3c47a3c23792f7dc84156e19a90722
233 236 b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e o default
234 237 6d6770faffce199f1fddd1cf87f6f026138cf061 o default
235 238 $ hg heads -R ../push-dest --template '{rev}:{node} {phase}\n' #update visible cache too
236 239 6:6d6770faffce199f1fddd1cf87f6f026138cf061 draft
237 240 5:2713879da13d6eea1ff22b442a5a87cb31a7ce6a secret
238 241 3:b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e draft
239 242 $ ls ../push-dest/.hg/cache/branch2*
240 243 ../push-dest/.hg/cache/branch2-base
241 244 ../push-dest/.hg/cache/branch2-served
242 245 ../push-dest/.hg/cache/branch2-visible
243 246 $ cat ../push-dest/.hg/cache/branch2-served
244 247 6d6770faffce199f1fddd1cf87f6f026138cf061 6 465891ffab3c47a3c23792f7dc84156e19a90722
245 248 b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e o default
246 249 6d6770faffce199f1fddd1cf87f6f026138cf061 o default
247 250 $ cat ../push-dest/.hg/cache/branch2-visible
248 251 6d6770faffce199f1fddd1cf87f6f026138cf061 6
249 252 b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e o default
250 253 2713879da13d6eea1ff22b442a5a87cb31a7ce6a o default
251 254 6d6770faffce199f1fddd1cf87f6f026138cf061 o default
252 255
253 256
254 257 Restore condition prior extra insertion.
255 258 $ hg -q --config extensions.mq= strip .
256 259 $ hg up -q 7
257 260 $ cd ..
258 261
259 262 Test secret changeset are not pull
260 263
261 264 $ hg init pull-dest
262 265 $ cd pull-dest
263 266 $ hg pull ../initialrepo
264 267 pulling from ../initialrepo
265 268 requesting all changes
266 269 adding changesets
267 270 adding manifests
268 271 adding file changes
269 272 added 5 changesets with 5 changes to 5 files (+1 heads)
270 273 new changesets 4a2df7238c3b:cf9fe039dfd6
271 274 test-debug-phase: new rev 0: x -> 0
272 275 test-debug-phase: new rev 1: x -> 0
273 276 test-debug-phase: new rev 2: x -> 0
274 277 test-debug-phase: new rev 3: x -> 0
275 278 test-debug-phase: new rev 4: x -> 0
276 279 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: -> public
277 280 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: -> public
278 281 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: -> public
279 282 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: -> public
280 283 test-hook-close-phase: cf9fe039dfd67e829edf6522a45de057b5c86519: -> public
281 284 (run 'hg heads' to see heads, 'hg merge' to merge)
282 285 $ hglog
283 286 4 0 B'
284 287 3 0 D
285 288 2 0 C
286 289 1 0 B
287 290 0 0 A
288 291 $ cd ..
289 292
290 293 But secret can still be bundled explicitly
291 294
292 295 $ cd initialrepo
293 296 $ hg bundle --base '4^' -r 'children(4)' ../secret-bundle.hg
294 297 4 changesets found
295 298 $ cd ..
296 299
297 300 Test secret changeset are not cloned
298 301 (during local clone)
299 302
300 303 $ hg clone -qU initialrepo clone-dest
301 304 test-debug-phase: new rev 0: x -> 0
302 305 test-debug-phase: new rev 1: x -> 0
303 306 test-debug-phase: new rev 2: x -> 0
304 307 test-debug-phase: new rev 3: x -> 0
305 308 test-debug-phase: new rev 4: x -> 0
306 309 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: -> public
307 310 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: -> public
308 311 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: -> public
309 312 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: -> public
310 313 test-hook-close-phase: cf9fe039dfd67e829edf6522a45de057b5c86519: -> public
311 314 $ hglog -R clone-dest
312 315 4 0 B'
313 316 3 0 D
314 317 2 0 C
315 318 1 0 B
316 319 0 0 A
317 320
318 321 Test summary
319 322
320 323 $ hg summary -R clone-dest --verbose
321 324 parent: -1:000000000000 (no revision checked out)
322 325 branch: default
323 326 commit: (clean)
324 327 update: 5 new changesets (update)
325 328 $ hg summary -R initialrepo
326 329 parent: 7:17a481b3bccb tip
327 330 merge B' and E
328 331 branch: default
329 332 commit: (clean) (secret)
330 333 update: 1 new changesets, 2 branch heads (merge)
331 334 phases: 3 draft, 3 secret
332 335 $ hg summary -R initialrepo --quiet
333 336 parent: 7:17a481b3bccb tip
334 337 update: 1 new changesets, 2 branch heads (merge)
335 338
336 339 Test revset
337 340
338 341 $ cd initialrepo
339 342 $ hglog -r 'public()'
340 343 0 0 A
341 344 1 0 B
342 345 $ hglog -r 'draft()'
343 346 2 1 C
344 347 3 1 D
345 348 6 1 B'
346 349 $ hglog -r 'secret()'
347 350 4 2 E
348 351 5 2 H
349 352 7 2 merge B' and E
350 353
351 354 test that phase are displayed in log at debug level
352 355
353 356 $ hg log --debug
354 357 changeset: 7:17a481b3bccb796c0521ae97903d81c52bfee4af
355 358 tag: tip
356 359 phase: secret
357 360 parent: 6:cf9fe039dfd67e829edf6522a45de057b5c86519
358 361 parent: 4:a603bfb5a83e312131cebcd05353c217d4d21dde
359 362 manifest: 7:5e724ffacba267b2ab726c91fc8b650710deaaa8
360 363 user: test
361 364 date: Thu Jan 01 00:00:00 1970 +0000
362 365 files+: C D E
363 366 extra: branch=default
364 367 description:
365 368 merge B' and E
366 369
367 370
368 371 changeset: 6:cf9fe039dfd67e829edf6522a45de057b5c86519
369 372 phase: draft
370 373 parent: 1:27547f69f25460a52fff66ad004e58da7ad3fb56
371 374 parent: -1:0000000000000000000000000000000000000000
372 375 manifest: 6:ab8bfef2392903058bf4ebb9e7746e8d7026b27a
373 376 user: test
374 377 date: Thu Jan 01 00:00:00 1970 +0000
375 378 files+: B'
376 379 extra: branch=default
377 380 description:
378 381 B'
379 382
380 383
381 384 changeset: 5:a030c6be5127abc010fcbff1851536552e6951a8
382 385 phase: secret
383 386 parent: 4:a603bfb5a83e312131cebcd05353c217d4d21dde
384 387 parent: -1:0000000000000000000000000000000000000000
385 388 manifest: 5:5c710aa854874fe3d5fa7192e77bdb314cc08b5a
386 389 user: test
387 390 date: Thu Jan 01 00:00:00 1970 +0000
388 391 files+: H
389 392 extra: branch=default
390 393 description:
391 394 H
392 395
393 396
394 397 changeset: 4:a603bfb5a83e312131cebcd05353c217d4d21dde
395 398 phase: secret
396 399 parent: 3:b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e
397 400 parent: -1:0000000000000000000000000000000000000000
398 401 manifest: 4:7173fd1c27119750b959e3a0f47ed78abe75d6dc
399 402 user: test
400 403 date: Thu Jan 01 00:00:00 1970 +0000
401 404 files+: E
402 405 extra: branch=default
403 406 description:
404 407 E
405 408
406 409
407 410 changeset: 3:b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e
408 411 phase: draft
409 412 parent: 2:f838bfaca5c7226600ebcfd84f3c3c13a28d3757
410 413 parent: -1:0000000000000000000000000000000000000000
411 414 manifest: 3:6e1f4c47ecb533ffd0c8e52cdc88afb6cd39e20c
412 415 user: test
413 416 date: Thu Jan 01 00:00:00 1970 +0000
414 417 files+: D
415 418 extra: branch=default
416 419 description:
417 420 D
418 421
419 422
420 423 changeset: 2:f838bfaca5c7226600ebcfd84f3c3c13a28d3757
421 424 phase: draft
422 425 parent: 1:27547f69f25460a52fff66ad004e58da7ad3fb56
423 426 parent: -1:0000000000000000000000000000000000000000
424 427 manifest: 2:66a5a01817fdf5239c273802b5b7618d051c89e4
425 428 user: test
426 429 date: Thu Jan 01 00:00:00 1970 +0000
427 430 files+: C
428 431 extra: branch=default
429 432 description:
430 433 C
431 434
432 435
433 436 changeset: 1:27547f69f25460a52fff66ad004e58da7ad3fb56
434 437 phase: public
435 438 parent: 0:4a2df7238c3b48766b5e22fafbb8a2f506ec8256
436 439 parent: -1:0000000000000000000000000000000000000000
437 440 manifest: 1:cb5cbbc1bfbf24cc34b9e8c16914e9caa2d2a7fd
438 441 user: test
439 442 date: Thu Jan 01 00:00:00 1970 +0000
440 443 files+: B
441 444 extra: branch=default
442 445 description:
443 446 B
444 447
445 448
446 449 changeset: 0:4a2df7238c3b48766b5e22fafbb8a2f506ec8256
447 450 phase: public
448 451 parent: -1:0000000000000000000000000000000000000000
449 452 parent: -1:0000000000000000000000000000000000000000
450 453 manifest: 0:007d8c9d88841325f5c6b06371b35b4e8a2b1a83
451 454 user: test
452 455 date: Thu Jan 01 00:00:00 1970 +0000
453 456 files+: A
454 457 extra: branch=default
455 458 description:
456 459 A
457 460
458 461
459 462
460 463
461 464 (Issue3707)
462 465 test invalid phase name
463 466
464 467 $ mkcommit I --config phases.new-commit='babar'
465 468 transaction abort!
466 469 rollback completed
467 470 abort: phases.new-commit: not a valid phase name ('babar')
468 471 [255]
469 472 Test phase command
470 473 ===================
471 474
472 475 initial picture
473 476
474 477 $ hg log -G --template "{rev} {phase} {desc}\n"
475 478 @ 7 secret merge B' and E
476 479 |\
477 480 | o 6 draft B'
478 481 | |
479 482 +---o 5 secret H
480 483 | |
481 484 o | 4 secret E
482 485 | |
483 486 o | 3 draft D
484 487 | |
485 488 o | 2 draft C
486 489 |/
487 490 o 1 public B
488 491 |
489 492 o 0 public A
490 493
491 494
492 495 display changesets phase
493 496
494 497 (mixing -r and plain rev specification)
495 498
496 499 $ hg phase 1::4 -r 7
497 500 1: public
498 501 2: draft
499 502 3: draft
500 503 4: secret
501 504 7: secret
502 505
503 506
504 507 move changeset forward
505 508
506 509 (with -r option)
507 510
508 511 $ hg phase --public -r 2
509 512 test-debug-phase: move rev 2: 1 -> 0
510 513 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: draft -> public
511 514 $ hg log -G --template "{rev} {phase} {desc}\n"
512 515 @ 7 secret merge B' and E
513 516 |\
514 517 | o 6 draft B'
515 518 | |
516 519 +---o 5 secret H
517 520 | |
518 521 o | 4 secret E
519 522 | |
520 523 o | 3 draft D
521 524 | |
522 525 o | 2 public C
523 526 |/
524 527 o 1 public B
525 528 |
526 529 o 0 public A
527 530
528 531
529 532 move changeset backward
530 533
531 534 (without -r option)
532 535
533 536 $ hg phase --draft --force 2
534 537 test-debug-phase: move rev 2: 0 -> 1
535 538 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: public -> draft
536 539 $ hg log -G --template "{rev} {phase} {desc}\n"
537 540 @ 7 secret merge B' and E
538 541 |\
539 542 | o 6 draft B'
540 543 | |
541 544 +---o 5 secret H
542 545 | |
543 546 o | 4 secret E
544 547 | |
545 548 o | 3 draft D
546 549 | |
547 550 o | 2 draft C
548 551 |/
549 552 o 1 public B
550 553 |
551 554 o 0 public A
552 555
553 556
554 557 move changeset forward and backward
555 558
556 559 $ hg phase --draft --force 1::4
557 560 test-debug-phase: move rev 1: 0 -> 1
558 561 test-debug-phase: move rev 4: 2 -> 1
559 562 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: public -> draft
560 563 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: secret -> draft
561 564 $ hg log -G --template "{rev} {phase} {desc}\n"
562 565 @ 7 secret merge B' and E
563 566 |\
564 567 | o 6 draft B'
565 568 | |
566 569 +---o 5 secret H
567 570 | |
568 571 o | 4 draft E
569 572 | |
570 573 o | 3 draft D
571 574 | |
572 575 o | 2 draft C
573 576 |/
574 577 o 1 draft B
575 578 |
576 579 o 0 public A
577 580
578 581 test partial failure
579 582
580 583 $ hg phase --public 7
581 584 test-debug-phase: move rev 1: 1 -> 0
582 585 test-debug-phase: move rev 2: 1 -> 0
583 586 test-debug-phase: move rev 3: 1 -> 0
584 587 test-debug-phase: move rev 4: 1 -> 0
585 588 test-debug-phase: move rev 6: 1 -> 0
586 589 test-debug-phase: move rev 7: 2 -> 0
587 590 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: draft -> public
588 591 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: draft -> public
589 592 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: draft -> public
590 593 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: draft -> public
591 594 test-hook-close-phase: cf9fe039dfd67e829edf6522a45de057b5c86519: draft -> public
592 595 test-hook-close-phase: 17a481b3bccb796c0521ae97903d81c52bfee4af: secret -> public
593 596 $ hg phase --draft '5 or 7'
594 597 test-debug-phase: move rev 5: 2 -> 1
595 598 test-hook-close-phase: a030c6be5127abc010fcbff1851536552e6951a8: secret -> draft
596 599 cannot move 1 changesets to a higher phase, use --force
597 600 phase changed for 1 changesets
598 601 [1]
599 602 $ hg log -G --template "{rev} {phase} {desc}\n"
600 603 @ 7 public merge B' and E
601 604 |\
602 605 | o 6 public B'
603 606 | |
604 607 +---o 5 draft H
605 608 | |
606 609 o | 4 public E
607 610 | |
608 611 o | 3 public D
609 612 | |
610 613 o | 2 public C
611 614 |/
612 615 o 1 public B
613 616 |
614 617 o 0 public A
615 618
616 619
617 620 test complete failure
618 621
619 622 $ hg phase --draft 7
620 623 cannot move 1 changesets to a higher phase, use --force
621 624 no phases changed
622 625 [1]
623 626
624 627 $ cd ..
625 628
626 629 test hidden changeset are not cloned as public (issue3935)
627 630
628 631 $ cd initialrepo
629 632
630 633 (enabling evolution)
631 634 $ cat >> $HGRCPATH << EOF
632 635 > [experimental]
633 636 > evolution.createmarkers=True
634 637 > EOF
635 638
636 639 (making a changeset hidden; H in that case)
637 640 $ hg debugobsolete `hg id --debug -r 5`
638 641 obsoleted 1 changesets
639 642
640 643 $ cd ..
641 644 $ hg clone initialrepo clonewithobs
642 645 requesting all changes
643 646 adding changesets
644 647 adding manifests
645 648 adding file changes
646 649 added 7 changesets with 6 changes to 6 files
647 650 new changesets 4a2df7238c3b:17a481b3bccb
648 651 test-debug-phase: new rev 0: x -> 0
649 652 test-debug-phase: new rev 1: x -> 0
650 653 test-debug-phase: new rev 2: x -> 0
651 654 test-debug-phase: new rev 3: x -> 0
652 655 test-debug-phase: new rev 4: x -> 0
653 656 test-debug-phase: new rev 5: x -> 0
654 657 test-debug-phase: new rev 6: x -> 0
655 658 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: -> public
656 659 test-hook-close-phase: 27547f69f25460a52fff66ad004e58da7ad3fb56: -> public
657 660 test-hook-close-phase: f838bfaca5c7226600ebcfd84f3c3c13a28d3757: -> public
658 661 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: -> public
659 662 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: -> public
660 663 test-hook-close-phase: cf9fe039dfd67e829edf6522a45de057b5c86519: -> public
661 664 test-hook-close-phase: 17a481b3bccb796c0521ae97903d81c52bfee4af: -> public
662 665 updating to branch default
663 666 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
664 667 $ cd clonewithobs
665 668 $ hg log -G --template "{rev} {phase} {desc}\n"
666 669 @ 6 public merge B' and E
667 670 |\
668 671 | o 5 public B'
669 672 | |
670 673 o | 4 public E
671 674 | |
672 675 o | 3 public D
673 676 | |
674 677 o | 2 public C
675 678 |/
676 679 o 1 public B
677 680 |
678 681 o 0 public A
679 682
680 683
681 684 test verify repo containing hidden changesets, which should not abort just
682 685 because repo.cancopy() is False
683 686
684 687 $ cd ../initialrepo
685 688 $ hg verify
686 689 checking changesets
687 690 checking manifests
688 691 crosschecking files in changesets and manifests
689 692 checking files
690 693 7 files, 8 changesets, 7 total revisions
691 694
692 695 $ cd ..
693 696
694 697 check whether HG_PENDING makes pending changes only in related
695 698 repositories visible to an external hook.
696 699
697 700 (emulate a transaction running concurrently by copied
698 701 .hg/phaseroots.pending in subsequent test)
699 702
700 703 $ cat > $TESTTMP/savepending.sh <<EOF
701 704 > cp .hg/store/phaseroots.pending .hg/store/phaseroots.pending.saved
702 705 > exit 1 # to avoid changing phase for subsequent tests
703 706 > EOF
704 707 $ cd push-dest
705 708 $ hg phase 6
706 709 6: draft
707 710 $ hg --config hooks.pretxnclose="sh $TESTTMP/savepending.sh" phase -f -s 6
708 711 transaction abort!
709 712 rollback completed
710 713 abort: pretxnclose hook exited with status 1
711 714 [255]
712 715 $ cp .hg/store/phaseroots.pending.saved .hg/store/phaseroots.pending
713 716
714 717 (check (in)visibility of phaseroot while transaction running in repo)
715 718
716 719 $ cat > $TESTTMP/checkpending.sh <<EOF
717 720 > echo '@initialrepo'
718 721 > hg -R "$TESTTMP/initialrepo" phase 7
719 722 > echo '@push-dest'
720 723 > hg -R "$TESTTMP/push-dest" phase 6
721 724 > exit 1 # to avoid changing phase for subsequent tests
722 725 > EOF
723 726 $ cd ../initialrepo
724 727 $ hg phase 7
725 728 7: public
726 729 $ hg --config hooks.pretxnclose="sh $TESTTMP/checkpending.sh" phase -f -s 7
727 730 @initialrepo
728 731 7: secret
729 732 @push-dest
730 733 6: draft
731 734 transaction abort!
732 735 rollback completed
733 736 abort: pretxnclose hook exited with status 1
734 737 [255]
735 738
736 739 Check that pretxnclose-phase hook can control phase movement
737 740
738 741 $ hg phase --force b3325c91a4d9 --secret
739 742 test-debug-phase: move rev 3: 0 -> 2
740 743 test-debug-phase: move rev 4: 0 -> 2
741 744 test-debug-phase: move rev 5: 1 -> 2
742 745 test-debug-phase: move rev 7: 0 -> 2
743 746 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: public -> secret
744 747 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: public -> secret
745 748 test-hook-close-phase: a030c6be5127abc010fcbff1851536552e6951a8: draft -> secret
746 749 test-hook-close-phase: 17a481b3bccb796c0521ae97903d81c52bfee4af: public -> secret
747 750 $ hg log -G -T phases
748 751 @ changeset: 7:17a481b3bccb
749 752 |\ tag: tip
750 753 | | phase: secret
751 754 | | parent: 6:cf9fe039dfd6
752 755 | | parent: 4:a603bfb5a83e
753 756 | | user: test
754 757 | | date: Thu Jan 01 00:00:00 1970 +0000
755 758 | | summary: merge B' and E
756 759 | |
757 760 | o changeset: 6:cf9fe039dfd6
758 761 | | phase: public
759 762 | | parent: 1:27547f69f254
760 763 | | user: test
761 764 | | date: Thu Jan 01 00:00:00 1970 +0000
762 765 | | summary: B'
763 766 | |
764 767 o | changeset: 4:a603bfb5a83e
765 768 | | phase: secret
766 769 | | user: test
767 770 | | date: Thu Jan 01 00:00:00 1970 +0000
768 771 | | summary: E
769 772 | |
770 773 o | changeset: 3:b3325c91a4d9
771 774 | | phase: secret
772 775 | | user: test
773 776 | | date: Thu Jan 01 00:00:00 1970 +0000
774 777 | | summary: D
775 778 | |
776 779 o | changeset: 2:f838bfaca5c7
777 780 |/ phase: public
778 781 | user: test
779 782 | date: Thu Jan 01 00:00:00 1970 +0000
780 783 | summary: C
781 784 |
782 785 o changeset: 1:27547f69f254
783 786 | phase: public
784 787 | user: test
785 788 | date: Thu Jan 01 00:00:00 1970 +0000
786 789 | summary: B
787 790 |
788 791 o changeset: 0:4a2df7238c3b
789 792 phase: public
790 793 user: test
791 794 date: Thu Jan 01 00:00:00 1970 +0000
792 795 summary: A
793 796
794 797
795 798 Install a hook that prevent b3325c91a4d9 to become public
796 799
797 800 $ cat >> .hg/hgrc << EOF
798 801 > [hooks]
799 > pretxnclose-phase.nopublish_D = (echo \$HG_NODE| grep -v b3325c91a4d9>/dev/null) || [ 'public' != \$HG_PHASE ]
802 > pretxnclose-phase.nopublish_D = sh -c "(echo \$HG_NODE| grep -v b3325c91a4d9>/dev/null) || [ 'public' != \$HG_PHASE ]"
800 803 > EOF
801 804
802 805 Try various actions. only the draft move should succeed
803 806
804 807 $ hg phase --public b3325c91a4d9
805 808 transaction abort!
806 809 rollback completed
807 810 abort: pretxnclose-phase.nopublish_D hook exited with status 1
808 811 [255]
809 812 $ hg phase --public a603bfb5a83e
810 813 transaction abort!
811 814 rollback completed
812 815 abort: pretxnclose-phase.nopublish_D hook exited with status 1
813 816 [255]
814 817 $ hg phase --draft 17a481b3bccb
815 818 test-debug-phase: move rev 3: 2 -> 1
816 819 test-debug-phase: move rev 4: 2 -> 1
817 820 test-debug-phase: move rev 7: 2 -> 1
818 821 test-hook-close-phase: b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e: secret -> draft
819 822 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: secret -> draft
820 823 test-hook-close-phase: 17a481b3bccb796c0521ae97903d81c52bfee4af: secret -> draft
821 824 $ hg phase --public 17a481b3bccb
822 825 transaction abort!
823 826 rollback completed
824 827 abort: pretxnclose-phase.nopublish_D hook exited with status 1
825 828 [255]
@@ -1,198 +1,202 b''
1 1 #require killdaemons
2 2
3 3 $ hg init test
4 4 $ cd test
5 5 $ echo a > a
6 6 $ hg ci -Ama
7 7 adding a
8 8 $ cd ..
9 9 $ hg clone test test2
10 10 updating to branch default
11 11 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
12 12 $ cd test2
13 13 $ echo a >> a
14 14 $ hg ci -mb
15 15 $ req() {
16 16 > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
17 17 > cat hg.pid >> $DAEMON_PIDS
18 18 > hg --cwd ../test2 push http://localhost:$HGPORT/
19 19 > exitstatus=$?
20 20 > killdaemons.py
21 21 > echo % serve errors
22 22 > cat errors.log
23 23 > return $exitstatus
24 24 > }
25 25 $ cd ../test
26 26
27 27 expect ssl error
28 28
29 29 $ req
30 30 pushing to http://localhost:$HGPORT/
31 31 searching for changes
32 32 abort: HTTP Error 403: ssl required
33 33 % serve errors
34 34 [255]
35 35
36 36 expect authorization error
37 37
38 38 $ echo '[web]' > .hg/hgrc
39 39 $ echo 'push_ssl = false' >> .hg/hgrc
40 40 $ req
41 41 pushing to http://localhost:$HGPORT/
42 42 searching for changes
43 43 abort: authorization failed
44 44 % serve errors
45 45 [255]
46 46
47 47 expect authorization error: must have authorized user
48 48
49 49 $ echo 'allow_push = unperson' >> .hg/hgrc
50 50 $ req
51 51 pushing to http://localhost:$HGPORT/
52 52 searching for changes
53 53 abort: authorization failed
54 54 % serve errors
55 55 [255]
56 56
57 57 expect success
58 58
59 $ cat > $TESTTMP/hook.sh <<'EOF'
60 > echo "phase-move: $HG_NODE: $HG_OLDPHASE -> $HG_PHASE"
61 > EOF
62
59 63 $ cat >> .hg/hgrc <<EOF
60 64 > allow_push = *
61 65 > [hooks]
62 66 > changegroup = sh -c "printenv.py changegroup 0"
63 67 > pushkey = sh -c "printenv.py pushkey 0"
64 > txnclose-phase.test = echo "phase-move: \$HG_NODE: \$HG_OLDPHASE -> \$HG_PHASE"
68 > txnclose-phase.test = sh $TESTTMP/hook.sh
65 69 > EOF
66 70 $ req
67 71 pushing to http://localhost:$HGPORT/
68 72 searching for changes
69 73 remote: adding changesets
70 74 remote: adding manifests
71 75 remote: adding file changes
72 76 remote: added 1 changesets with 1 changes to 1 files
73 77 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public
74 78 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public
75 79 remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
76 80 % serve errors
77 81 $ hg rollback
78 82 repository tip rolled back to revision 0 (undo serve)
79 83
80 84 expect success, server lacks the httpheader capability
81 85
82 86 $ CAP=httpheader
83 87 $ . "$TESTDIR/notcapable"
84 88 $ req
85 89 pushing to http://localhost:$HGPORT/
86 90 searching for changes
87 91 remote: adding changesets
88 92 remote: adding manifests
89 93 remote: adding file changes
90 94 remote: added 1 changesets with 1 changes to 1 files
91 95 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public
92 96 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public
93 97 remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
94 98 % serve errors
95 99 $ hg rollback
96 100 repository tip rolled back to revision 0 (undo serve)
97 101
98 102 expect success, server lacks the unbundlehash capability
99 103
100 104 $ CAP=unbundlehash
101 105 $ . "$TESTDIR/notcapable"
102 106 $ req
103 107 pushing to http://localhost:$HGPORT/
104 108 searching for changes
105 109 remote: adding changesets
106 110 remote: adding manifests
107 111 remote: adding file changes
108 112 remote: added 1 changesets with 1 changes to 1 files
109 113 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public
110 114 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public
111 115 remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
112 116 % serve errors
113 117 $ hg rollback
114 118 repository tip rolled back to revision 0 (undo serve)
115 119
116 120 expect push success, phase change failure
117 121
118 122 $ cat > .hg/hgrc <<EOF
119 123 > [web]
120 124 > push_ssl = false
121 125 > allow_push = *
122 126 > [hooks]
123 127 > prepushkey = sh -c "printenv.py prepushkey 1"
124 128 > [devel]
125 129 > legacy.exchange=phases
126 130 > EOF
127 131 $ req
128 132 pushing to http://localhost:$HGPORT/
129 133 searching for changes
130 134 remote: adding changesets
131 135 remote: adding manifests
132 136 remote: adding file changes
133 137 remote: added 1 changesets with 1 changes to 1 files
134 138 remote: prepushkey hook: HG_BUNDLE2=1 HG_HOOKNAME=prepushkey HG_HOOKTYPE=prepushkey HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NAMESPACE=phases HG_NEW=0 HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_OLD=1 HG_PENDING=$TESTTMP/test HG_PHASES_MOVED=1 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
135 139 remote: pushkey-abort: prepushkey hook exited with status 1
136 140 remote: transaction abort!
137 141 remote: rollback completed
138 142 abort: updating ba677d0156c1 to public failed
139 143 % serve errors
140 144 [255]
141 145
142 146 expect phase change success
143 147
144 148 $ cat >> .hg/hgrc <<EOF
145 149 > prepushkey = sh -c "printenv.py prepushkey 0"
146 150 > [devel]
147 151 > legacy.exchange=
148 152 > EOF
149 153 $ req
150 154 pushing to http://localhost:$HGPORT/
151 155 searching for changes
152 156 remote: adding changesets
153 157 remote: adding manifests
154 158 remote: adding file changes
155 159 remote: added 1 changesets with 1 changes to 1 files
156 160 % serve errors
157 161 $ hg rollback
158 162 repository tip rolled back to revision 0 (undo serve)
159 163
160 164 expect authorization error: all users denied
161 165
162 166 $ echo '[web]' > .hg/hgrc
163 167 $ echo 'push_ssl = false' >> .hg/hgrc
164 168 $ echo 'deny_push = *' >> .hg/hgrc
165 169 $ req
166 170 pushing to http://localhost:$HGPORT/
167 171 searching for changes
168 172 abort: authorization failed
169 173 % serve errors
170 174 [255]
171 175
172 176 expect authorization error: some users denied, users must be authenticated
173 177
174 178 $ echo 'deny_push = unperson' >> .hg/hgrc
175 179 $ req
176 180 pushing to http://localhost:$HGPORT/
177 181 searching for changes
178 182 abort: authorization failed
179 183 % serve errors
180 184 [255]
181 185
182 186 $ cat > .hg/hgrc <<EOF
183 187 > [web]
184 188 > push_ssl = false
185 189 > allow_push = *
186 190 > [experimental]
187 191 > httppostargs=true
188 192 > EOF
189 193 $ req
190 194 pushing to http://localhost:$HGPORT/
191 195 searching for changes
192 196 remote: adding changesets
193 197 remote: adding manifests
194 198 remote: adding file changes
195 199 remote: added 1 changesets with 1 changes to 1 files
196 200 % serve errors
197 201
198 202 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now