# HG changeset patch # User Pierre-Yves David # Date 2016-02-02 15:24:11 # Node ID 6b1fc09c699a0d017b0bf02f84cb0ad9551138d3 # Parent 9e0535da20a58a5419af5f52e39976c3e1bcecea update: change default destination to tipmost descendant (issue4673) (BC) Bare 'hg update' now brings you to the tipmost descendant (on the same branch). Leaving the user on the same topological branch. The previous behavior, updating to the tipmost changeset on the same branch could lead to jump from a topological branch to another. This was confusing and impractical. As the only conceivable reason for the old behavior have been address by the recently introduce message about other heads, we can "safely" change this behavior All test changes have been reviewed and seen a valid consequences. diff --git a/mercurial/destutil.py b/mercurial/destutil.py --- a/mercurial/destutil.py +++ b/mercurial/destutil.py @@ -92,7 +92,8 @@ def _destupdatebranch(repo, clean, check wc = repo[None] movemark = node = None try: - node = repo.branchtip(wc.branch()) + node = repo.revs('max(.::(head() and branch(%s)))' + , wc.branch()).first() if bookmarks.isactivewdirparent(repo): movemark = repo['.'].node() except error.RepoLookupError: diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t --- a/tests/test-bookmarks.t +++ b/tests/test-bookmarks.t @@ -735,35 +735,12 @@ tipmost surviving ancestor of the stripp date: Thu Jan 01 00:00:00 1970 +0000 summary: 0 -test non-linear update not clearing active bookmark - - $ hg up 1 - 1 files updated, 0 files merged, 2 files removed, 0 files unresolved - (leaving bookmark four) - $ hg book drop - $ hg up -C - 1 files updated, 0 files merged, 1 files removed, 0 files unresolved - (leaving bookmark drop) - 1 other heads for branch "default" - $ hg sum - parent: 2:db815d6d32e6 - 2 - branch: default - bookmarks: should-end-on-two - commit: 2 unknown (clean) - update: 1 new changesets, 2 branch heads (merge) - phases: 4 draft - $ hg book - drop 1:925d80f479bb - four 3:9ba5f110a0b3 - should-end-on-two 2:db815d6d32e6 - $ hg book -d drop - $ hg up four - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - (activating bookmark four) no-op update doesn't deactive bookmarks + $ hg up four + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + (activating bookmark four) $ hg up 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg sum diff --git a/tests/test-largefiles-cache.t b/tests/test-largefiles-cache.t --- a/tests/test-largefiles-cache.t +++ b/tests/test-largefiles-cache.t @@ -189,7 +189,7 @@ conditional above. Inject corruption into the largefiles store and see how update handles that: $ cd src - $ hg up -qC + $ hg up -qC tip $ cat large modified $ rm large diff --git a/tests/test-merge-criss-cross.t b/tests/test-merge-criss-cross.t --- a/tests/test-merge-criss-cross.t +++ b/tests/test-merge-criss-cross.t @@ -212,7 +212,7 @@ Verify how the output looks and and how 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) - $ hg up -qC + $ hg up -qC tip $ hg merge -v note: merging 3b08d01b0ab5+ and adfe50279922 using bids from ancestors 0f6b37dbe527 and 40663881a6dd diff --git a/tests/test-merge5.t b/tests/test-merge5.t --- a/tests/test-merge5.t +++ b/tests/test-merge5.t @@ -13,18 +13,13 @@ created new head $ hg update 1 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ hg update - abort: not a linear update - (merge or update --check to force update) - [255] $ rm b - $ hg update -c + $ hg update -c 2 abort: uncommitted changes [255] $ hg revert b - $ hg update -c + $ hg update -c 2 0 files updated, 0 files merged, 1 files removed, 0 files unresolved - 1 other heads for branch "default" $ mv a c Should abort: diff --git a/tests/test-pull-update.t b/tests/test-pull-update.t --- a/tests/test-pull-update.t +++ b/tests/test-pull-update.t @@ -16,7 +16,7 @@ $ echo 1.2 > foo $ hg ci -Am m -Should not update: +Should not update to the other topological branch: $ hg pull -u ../tt pulling from ../tt @@ -25,13 +25,12 @@ Should not update: adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) - abort: not updating: not a linear update - (merge or update --check to force update) - [255] + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + 1 other heads for branch "default" $ cd ../tt -Should not update: +Should not update to the other branch: $ hg pull -u ../t pulling from ../t @@ -40,9 +39,8 @@ Should not update: adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) - abort: not updating: not a linear update - (merge or update --check to force update) - [255] + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + 1 other heads for branch "default" $ HGMERGE=true hg merge merging foo diff --git a/tests/test-up-local-change.t b/tests/test-up-local-change.t --- a/tests/test-up-local-change.t +++ b/tests/test-up-local-change.t @@ -172,9 +172,8 @@ create a second head summary: 2 $ hg --debug up - abort: uncommitted changes - (commit and merge, or update --clean to discard changes) - [255] + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + 1 other heads for branch "default" test conflicting untracked files diff --git a/tests/test-update-branches.t b/tests/test-update-branches.t --- a/tests/test-update-branches.t +++ b/tests/test-update-branches.t @@ -93,8 +93,8 @@ Cases are run as shown in that table, ro parent=5 $ norevtest 'none clean same' clean 2 - abort: not a linear update - (merge or update --check to force update) + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + 1 other heads for branch "default" parent=2 @@ -140,8 +140,8 @@ Cases are run as shown in that table, ro M foo $ norevtest 'none dirty cross' dirty 2 - abort: uncommitted changes - (commit and merge, or update --clean to discard changes) + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + 1 other heads for branch "default" parent=2 M foo @@ -166,9 +166,9 @@ Cases are run as shown in that table, ro M sub/suba $ norevtest '-c clean same' clean 2 -c - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved 1 other heads for branch "default" - parent=3 + parent=2 $ revtest '-cC dirty linear' dirty 1 2 -cC abort: cannot specify both -c/--check and -C/--clean