comparison tests/test-newbranch.t @ 28924:d9539959167d

update: resurrect bare update from null parent to tip-most branch head The situation is tricky if repository has no "default" branch, because "null" revision belongs to non-existent "default" branch. Before e1dd0de26557, bare update from null would bring us to the tip-most non-closed branch head. e1dd0de26557 removed the special handling of missing "default" branch since we wanted to stick to the uncommitted branch in that case. But, if the parent is "null" revision, and if the missing branch is "default", it shouldn't be an uncommitted branch. In this case, bare update should bring us to the tip-most head as before. This should fix the test breakage introduced by e1dd0de26557.
author Yuya Nishihara <yuya@tcha.org>
date Fri, 15 Apr 2016 20:37:11 +0900
parents e1dd0de26557
children 1c7167009936
comparison
equal deleted inserted replaced
28923:531dea16f4f7 28924:d9539959167d
389 b 389 b
390 branch: dev 390 branch: dev
391 commit: (new branch) 391 commit: (new branch)
392 update: (current) 392 update: (current)
393 phases: 3 draft 393 phases: 3 draft
394
395 $ cd ..
396
397 We need special handling for repositories with no "default" branch because
398 "null" revision belongs to non-existent "default" branch.
399
400 $ hg init nodefault
401 $ cd nodefault
402 $ hg branch -q foo
403 $ touch 0
404 $ hg ci -Aqm0
405 $ touch 1
406 $ hg ci -Aqm1
407 $ hg update -qr0
408 $ hg branch -q bar
409 $ touch 2
410 $ hg ci -Aqm2
411 $ hg update -qr0
412 $ hg branch -q baz
413 $ touch 3
414 $ hg ci -Aqm3
415 $ hg ci --close-branch -m 'close baz'
416 $ hg update -q null
417 $ hg log -GT'{rev} {branch}\n'
418 _ 4 baz
419 |
420 o 3 baz
421 |
422 | o 2 bar
423 |/
424 | o 1 foo
425 |/
426 o 0 foo
427
428
429 a) updating from "null" should bring us to the tip-most branch head as
430 there is no "default" branch:
431
432 $ hg update -q null
433 $ hg id -bn
434 -1 default
435 $ hg update
436 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
437 $ hg id -bn
438 2 bar
439
440 b) but if we are at uncommitted "default" branch, we should stick to the
441 current revision:
442
443 $ hg update -q 0
444 $ hg branch default
445 marked working directory as branch default
446 $ hg id -bn
447 0 default
448 $ hg update
449 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
450 $ hg id -bn
451 0 default
452
453 c) also, if we have uncommitted branch at "null", we should stick to it:
454
455 $ hg update -q null
456 $ hg branch new
457 marked working directory as branch new
458 $ hg id -bn
459 -1 new
460 $ hg update
461 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
462 $ hg id -bn
463 -1 new
464
465 $ cd ..