diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -5528,7 +5528,11 @@ def update(ui, repo, node=None, rev=None # if we defined a bookmark, we have to remember the original name brev = rev - rev = scmutil.revsingle(repo, rev, rev).rev() + repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn') + ctx = scmutil.revsingle(repo, rev, rev) + rev = ctx.rev() + if ctx.hidden(): + ui.warn(_("updating to a hidden changeset %s\n") % ctx.hex()[:12]) repo.ui.setconfig('ui', 'forcemerge', tool, 'update') diff --git a/tests/test-directaccess.t b/tests/test-directaccess.t --- a/tests/test-directaccess.t +++ b/tests/test-directaccess.t @@ -143,6 +143,15 @@ Testing with hash $ hg status --change 28ad74 A c +`hg update` + + $ hg up 28ad74 + updating to a hidden changeset 28ad74487de9 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + + $ hg up 3 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + Commands with undefined cmdtype should not work right now $ hg phase -r 28ad74 diff --git a/tests/test-log.t b/tests/test-log.t --- a/tests/test-log.t +++ b/tests/test-log.t @@ -1824,6 +1824,7 @@ enable obsolete to test hidden feature test that parent prevent a changeset to be hidden $ hg up 1 -q --hidden + updating to a hidden changeset a765632148dc $ hg log --template='{rev}:{node}\n' 1:a765632148dc55d38c35c4f247c618701886cb2f 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05 diff --git a/tests/test-obsmarker-template.t b/tests/test-obsmarker-template.t --- a/tests/test-obsmarker-template.t +++ b/tests/test-obsmarker-template.t @@ -75,6 +75,7 @@ Test setup Check templates --------------- $ hg up 'desc(A0)' --hidden + updating to a hidden changeset 471f378eab4c 1 files updated, 0 files merged, 0 files removed, 0 files unresolved Predecessors template should show current revision as it is the working copy @@ -146,6 +147,7 @@ Predecessors template should show curren summary: ROOT $ hg up 'desc(A1)' --hidden + updating to a hidden changeset a468dc9b3633 1 files updated, 0 files merged, 0 files removed, 0 files unresolved Predecessors template should show current revision as it is the working copy @@ -413,6 +415,7 @@ Check templates --------------- $ hg up 'obsolete()' --hidden + updating to a hidden changeset 471597cad322 0 files updated, 0 files merged, 0 files removed, 0 files unresolved Predecessors template should show current revision as it is the working copy @@ -620,6 +623,7 @@ Check templates --------------- $ hg up 'desc(A0)' --hidden + updating to a hidden changeset 471f378eab4c 0 files updated, 0 files merged, 1 files removed, 0 files unresolved Predecessors template should show current revision as it is the working copy @@ -644,6 +648,7 @@ Predecessors template should show curren o ea207398892e $ hg up 'desc(B0)' --hidden + updating to a hidden changeset 0dec01379d3b 1 files updated, 0 files merged, 0 files removed, 0 files unresolved Predecessors template should show both predecessors as they should be both @@ -809,6 +814,7 @@ Test setup summary: ROOT $ hg update --hidden 'desc(A0)' + updating to a hidden changeset 471f378eab4c 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg commit --amend -m "A2" $ hg log --hidden -G @@ -880,6 +886,7 @@ Check templates --------------- $ hg up 'desc(A0)' --hidden + updating to a hidden changeset 471f378eab4c 0 files updated, 0 files merged, 0 files removed, 0 files unresolved Predecessors template should show current revision as it is the working copy @@ -1144,6 +1151,7 @@ Check templates --------------- $ hg up 'desc(A0)' --hidden + updating to a hidden changeset 471f378eab4c 0 files updated, 0 files merged, 1 files removed, 0 files unresolved Predecessors template should show current revision as it is the working copy @@ -1168,6 +1176,7 @@ Predecessors template should show curren o ea207398892e $ hg up 'desc(B0)' --hidden + updating to a hidden changeset 0dec01379d3b 1 files updated, 0 files merged, 0 files removed, 0 files unresolved Predecessors template should both predecessors as they are visible @@ -1198,6 +1207,7 @@ Predecessors template should both predec o ea207398892e $ hg up 'desc(B1)' --hidden + updating to a hidden changeset b7ea6d14e664 0 files updated, 0 files merged, 0 files removed, 0 files unresolved Predecessors template should both predecessors as they are visible @@ -1599,6 +1609,7 @@ Check templates $ hg up -r "desc(B0)" --hidden + updating to a hidden changeset 0dec01379d3b 2 files updated, 0 files merged, 1 files removed, 0 files unresolved $ hg tlog o f897c6137566 @@ -2059,6 +2070,7 @@ Check templates o ea207398892e $ hg up --hidden 4 + updating to a hidden changeset 9bd10a0775e4 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg rebase -r 7 -d 8 --config extensions.rebase= rebasing 7:ba2ed02b0c9a "Add A,B,C" @@ -2303,6 +2315,7 @@ Test setup obsoleted 1 changesets $ hg up -r "desc(A0)" --hidden + updating to a hidden changeset 471f378eab4c 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg commit --amend -m "A2" $ hg debugobsolete --record-parent `getid "."` @@ -2312,6 +2325,7 @@ Check output ------------ $ hg up "desc(A0)" --hidden + updating to a hidden changeset 471f378eab4c 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg tlog @ 471f378eab4c @@ -2465,6 +2479,7 @@ Check templates --------------- $ hg up 'desc("A0")' --hidden + updating to a hidden changeset 471597cad322 0 files updated, 0 files merged, 0 files removed, 0 files unresolved # todo: the obsfate output is not ideal @@ -2476,6 +2491,7 @@ Check templates o ea207398892e $ hg up -r 'desc("A2")' --hidden + updating to a hidden changeset 0d0ef4bdf70e 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg fatelog --hidden diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t --- a/tests/test-obsolete.t +++ b/tests/test-obsolete.t @@ -62,6 +62,7 @@ Killing a single changeset without repla $ hg tip -1:000000000000 (public) [tip ] $ hg up --hidden tip --quiet + updating to a hidden changeset 97b7c2d76b18 Killing a single changeset with itself should fail (simple local safeguard) diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t --- a/tests/test-rebase-obsolete.t +++ b/tests/test-rebase-obsolete.t @@ -280,6 +280,7 @@ a working copy parent. We should be move even though it is hidden (until we're moved there). $ hg --hidden up -qr 'first(hidden())' + updating to a hidden changeset 42ccdea3bb16 $ hg rebase --rev 13 --dest 15 rebasing 13:98f6af4ee953 "C" $ hg log -G @@ -610,6 +611,7 @@ test on rebase dropping a merge Test hidden changesets in the rebase set (issue4504) $ hg up --hidden 9 + updating to a hidden changeset 4bde274eefcf 3 files updated, 0 files merged, 1 files removed, 0 files unresolved $ echo J > J $ hg add J @@ -725,6 +727,7 @@ setup $ hg commit --amend -m B1 $ hg commit --amend -m B2 $ hg up --hidden 'desc(B0)' + updating to a hidden changeset a8b11f55fb19 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ echo C > C $ hg add C @@ -748,6 +751,7 @@ Rebase finds its way in a chain of marke Even when the chain include missing node $ hg up --hidden 'desc(B0)' + updating to a hidden changeset a8b11f55fb19 0 files updated, 0 files merged, 1 files removed, 0 files unresolved $ echo D > D $ hg add D @@ -862,6 +866,7 @@ If a rebase is going to create divergenc $ hg add bar $ hg commit --amend -m "10'" $ hg up 10 --hidden + updating to a hidden changeset 121d9e3bc4c6 0 files updated, 0 files merged, 1 files removed, 0 files unresolved $ echo "bar" > foo $ hg add foo @@ -1595,6 +1600,7 @@ rebasestate may contain hidden hashes. " $ rm .hg/localtags $ hg update -q $C --hidden + updating to a hidden changeset 7829726be4dc $ hg rebase -s $B -d $D rebasing 1:2ec65233581b "B" merging D 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 @@ -520,6 +520,7 @@ Test that 4 is detected as the no-argume the bookmark with it $ hg up --quiet 0 # we should be able to update to 3 directly $ hg up --quiet --hidden 3 # but not implemented yet. + updating to a hidden changeset 6efa171f091b $ hg book -f bm $ hg up 1 files updated, 0 files merged, 0 files removed, 0 files unresolved @@ -530,6 +531,7 @@ the bookmark with it Test that 5 is detected as a valid destination from 1 $ hg up --quiet 0 # we should be able to update to 3 directly $ hg up --quiet --hidden 3 # but not implemented yet. + updating to a hidden changeset 6efa171f091b $ hg up 5 1 files updated, 0 files merged, 0 files removed, 0 files unresolved