Show More
@@ -101,6 +101,10 b' def _destupdatebranch(repo, clean, check' | |||
|
101 | 101 | node = repo.revs('max(.::(%ln))', heads).first() |
|
102 | 102 | if bookmarks.isactivewdirparent(repo): |
|
103 | 103 | movemark = repo['.'].node() |
|
104 | elif currentbranch == 'default' and not wc.p1(): | |
|
105 | # "null" parent belongs to "default" branch, but it doesn't exist, so | |
|
106 | # update to the tipmost non-closed branch head | |
|
107 | node = repo.revs('max(head() and not closed())').first() | |
|
104 | 108 | else: |
|
105 | 109 | node = repo['.'].node() |
|
106 | 110 | return node, movemark, None |
@@ -391,3 +391,75 b' We expect that bare update on new branch' | |||
|
391 | 391 | commit: (new branch) |
|
392 | 392 | update: (current) |
|
393 | 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 .. |
General Comments 0
You need to be logged in to leave comments.
Login now