##// END OF EJS Templates
update: fix bare --clean to work on new branch (issue5003) (BC)...
liscju -
r29284:1c716700 default
parent child Browse files
Show More
@@ -95,6 +95,10 b' def _destupdatebranch(repo, clean, check'
95 wc = repo[None]
95 wc = repo[None]
96 movemark = node = None
96 movemark = node = None
97 currentbranch = wc.branch()
97 currentbranch = wc.branch()
98
99 if clean:
100 currentbranch = repo['.'].branch()
101
98 if currentbranch in repo.branchmap():
102 if currentbranch in repo.branchmap():
99 heads = repo.branchheads(currentbranch)
103 heads = repo.branchheads(currentbranch)
100 if heads:
104 if heads:
@@ -463,3 +463,72 b' We need special handling for repositorie'
463 -1 new
463 -1 new
464
464
465 $ cd ..
465 $ cd ..
466
467 We expect that update --clean discard changes in working directory,
468 and updates to the head of parent branch.
469
470 $ hg init updatebareclean
471 $ cd updatebareclean
472 $ hg update --clean
473 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
474 $ touch a
475 $ hg commit -A -m "a"
476 adding a
477 $ touch b
478 $ hg commit -A -m "b"
479 adding b
480 $ touch c
481 $ hg commit -A -m "c"
482 adding c
483 $ hg log
484 changeset: 2:991a3460af53
485 tag: tip
486 user: test
487 date: Thu Jan 01 00:00:00 1970 +0000
488 summary: c
489
490 changeset: 1:0e067c57feba
491 user: test
492 date: Thu Jan 01 00:00:00 1970 +0000
493 summary: b
494
495 changeset: 0:3903775176ed
496 user: test
497 date: Thu Jan 01 00:00:00 1970 +0000
498 summary: a
499
500 $ hg update -r 1
501 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
502 $ hg branch new-branch
503 marked working directory as branch new-branch
504 (branches are permanent and global, did you want a bookmark?)
505 $ echo "aa" >> a
506 $ hg update --clean
507 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
508 $ hg status
509 $ hg branch
510 default
511 $ hg parent
512 changeset: 2:991a3460af53
513 tag: tip
514 user: test
515 date: Thu Jan 01 00:00:00 1970 +0000
516 summary: c
517
518 We expect that update --clean on non existing parent discards a new branch
519 and updates to the tipmost non-closed branch head
520
521 $ hg update null
522 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
523 $ hg branch newbranch
524 marked working directory as branch newbranch
525 (branches are permanent and global, did you want a bookmark?)
526 $ hg update -C
527 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
528 $ hg summary
529 parent: 2:991a3460af53 tip
530 c
531 branch: default
532 commit: (clean)
533 update: (current)
534 phases: 3 draft
General Comments 0
You need to be logged in to leave comments. Login now