##// END OF EJS Templates
destutil: if wdp is obsolete, update to the closest non-obsolete ancestor...
av6 -
r49538:fbf7e383 default
parent child Browse files
Show More
@@ -65,9 +65,8 b' def _destupdateobs(repo, clean):'
65 # replaced changesets: same as divergent except we know there
65 # replaced changesets: same as divergent except we know there
66 # is no conflict
66 # is no conflict
67 #
67 #
68 # pruned changeset: no update is done; though, we could
68 # pruned changeset: update to the closest non-obsolete ancestor,
69 # consider updating to the first non-obsolete parent,
69 # similar to what 'hg prune' currently does
70 # similar to what is current done for 'hg prune'
71
70
72 if successors:
71 if successors:
73 # flatten the list here handles both divergent (len > 1)
72 # flatten the list here handles both divergent (len > 1)
@@ -77,11 +76,15 b' def _destupdateobs(repo, clean):'
77 # get the max revision for the given successors set,
76 # get the max revision for the given successors set,
78 # i.e. the 'tip' of a set
77 # i.e. the 'tip' of a set
79 node = repo.revs(b'max(%ln)', successors).first()
78 node = repo.revs(b'max(%ln)', successors).first()
80 if bookmarks.isactivewdirparent(repo):
81 movemark = repo[b'.'].node()
82 else:
79 else:
83 # TODO: copy hg prune logic
80 p1 = p1.p1()
84 node = repo[b'.'].node()
81 while p1.obsolete():
82 p1 = p1.p1()
83 node = p1.node()
84
85 if node is not None and bookmarks.isactivewdirparent(repo):
86 movemark = repo[b'.'].node()
87
85 return node, movemark, None
88 return node, movemark, None
86
89
87
90
@@ -696,9 +696,8 b' Test that 5 is not detected as a valid d'
696 (commit or update --clean to discard changes)
696 (commit or update --clean to discard changes)
697 [255]
697 [255]
698
698
699 Test that we don't crash when updating from a pruned changeset (i.e. has no
699 Test that we update to the closest non-obsolete ancestor when updating from a
700 successors). Behavior should probably be that we update to the first
700 pruned changeset (i.e. that has no successors)
701 non-obsolete parent but that will be decided later.
702 $ hg id --debug -r 2
701 $ hg id --debug -r 2
703 bd10386d478cd5a9faf2e604114c8e6da62d3889
702 bd10386d478cd5a9faf2e604114c8e6da62d3889
704 $ hg up --quiet 0
703 $ hg up --quiet 0
@@ -706,21 +705,18 b' non-obsolete parent but that will be dec'
706 $ hg debugobsolete bd10386d478cd5a9faf2e604114c8e6da62d3889
705 $ hg debugobsolete bd10386d478cd5a9faf2e604114c8e6da62d3889
707 1 new obsolescence markers
706 1 new obsolescence markers
708 obsoleted 1 changesets
707 obsoleted 1 changesets
708 $ hg log -r '_destupdate()'
709 1:0786582aa4b1 1 (no-eol)
709 $ hg up
710 $ hg up
710 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
711 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
711
712 Test experimental revset support
713
714 $ hg log -r '_destupdate()'
715 2:bd10386d478c 2 (no-eol)
716
712
717 Test that boolean flags allow --no-flag specification to override [defaults]
713 Test that boolean flags allow --no-flag specification to override [defaults]
718 $ cat >> $HGRCPATH <<EOF
714 $ cat >> $HGRCPATH <<EOF
719 > [defaults]
715 > [defaults]
720 > update = --check
716 > update = --check
721 > EOF
717 > EOF
722 $ hg co 2
718 $ hg co 1
723 abort: uncommitted changes
719 abort: uncommitted changes
724 [20]
720 [20]
725 $ hg co --no-check 2
721 $ hg co --no-check 1
726 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
722 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
General Comments 0
You need to be logged in to leave comments. Login now