diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -43,6 +43,7 @@ lock as lockmod, merge as mergemod, obsolete, + obsutil, patch, phases, pycompat, @@ -5534,7 +5535,12 @@ ctx = scmutil.revsingle(repo, rev, rev) rev = ctx.rev() if ctx.hidden(): - ui.warn(_("updating to a hidden changeset %s\n") % ctx.hex()[:12]) + ctxstr = ctx.hex()[:12] + ui.warn(_("updating to a hidden changeset %s\n") % ctxstr) + + if ctx.obsolete(): + obsfatemsg = obsutil._getfilteredreason(repo, ctxstr, ctx) + ui.warn("(%s)\n" % obsfatemsg) 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 @@ -157,6 +157,7 @@ $ hg up 28ad74 updating to a hidden changeset 28ad74487de9 + (hidden revision '28ad74487de9' was rewritten as: 2443a0e66469) 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg up 3 diff --git a/tests/test-log.t b/tests/test-log.t --- a/tests/test-log.t +++ b/tests/test-log.t @@ -1835,6 +1835,7 @@ $ hg up 1 -q --hidden updating to a hidden changeset a765632148dc + (hidden revision 'a765632148dc' is pruned) $ hg log --template='{rev}:{node}\n' 1:a765632148dc55d38c35c4f247c618701886cb2f 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05 diff --git a/tests/test-obshistory.t b/tests/test-obshistory.t --- a/tests/test-obshistory.t +++ b/tests/test-obshistory.t @@ -56,6 +56,7 @@ [255] $ hg update --hidden "desc(A0)" updating to a hidden changeset 471f378eab4c + (hidden revision '471f378eab4c' was rewritten as: 4ae3a4151de9) 1 files updated, 0 files merged, 0 files removed, 0 files unresolved Test output with pruned commit @@ -118,6 +119,7 @@ [255] $ hg up --hidden -r 'desc(B0)' updating to a hidden changeset 0dec01379d3b + (hidden revision '0dec01379d3b' is pruned) 1 files updated, 0 files merged, 0 files removed, 0 files unresolved Test output with splitted commit @@ -194,6 +196,7 @@ [255] $ hg update --hidden 'min(desc(A0))' updating to a hidden changeset 471597cad322 + (hidden revision '471597cad322' was split as: 337fec4d2edc, f257fde29c7a) 0 files updated, 0 files merged, 0 files removed, 0 files unresolved Test output with lots of splitted commit @@ -292,6 +295,7 @@ [255] $ hg update --hidden 'min(desc(A0))' updating to a hidden changeset de7290d8b885 + (hidden revision 'de7290d8b885' was split as: 337fec4d2edc, f257fde29c7a and 2 more) 0 files updated, 0 files merged, 0 files removed, 0 files unresolved Test output with folded commit @@ -369,6 +373,7 @@ [255] $ hg update --hidden 'desc(A0)' updating to a hidden changeset 471f378eab4c + (hidden revision '471f378eab4c' was rewritten as: eb5a0daa2192) 0 files updated, 0 files merged, 1 files removed, 0 files unresolved $ hg update 0dec01379d3b abort: hidden revision '0dec01379d3b' was rewritten as: eb5a0daa2192! @@ -376,6 +381,7 @@ [255] $ hg update --hidden 'desc(B0)' updating to a hidden changeset 0dec01379d3b + (hidden revision '0dec01379d3b' was rewritten as: eb5a0daa2192) 1 files updated, 0 files merged, 0 files removed, 0 files unresolved Test output with divergence @@ -410,6 +416,7 @@ $ hg update --hidden 'desc(A0)' updating to a hidden changeset 471f378eab4c + (hidden revision '471f378eab4c' was rewritten as: fdf9bde5129a) 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg commit --amend -m "A2" $ hg log --hidden -G @@ -448,6 +455,7 @@ [255] $ hg update --hidden 'desc(A0)' updating to a hidden changeset 471f378eab4c + (hidden revision '471f378eab4c' has diverged) 0 files updated, 0 files merged, 0 files removed, 0 files unresolved Test output with amended + folded commit @@ -541,9 +549,11 @@ [255] $ hg update --hidden 'desc(A0)' updating to a hidden changeset 471f378eab4c + (hidden revision '471f378eab4c' was rewritten as: eb5a0daa2192) 0 files updated, 0 files merged, 1 files removed, 0 files unresolved $ hg update --hidden 0dec01379d3b updating to a hidden changeset 0dec01379d3b + (hidden revision '0dec01379d3b' was rewritten as: eb5a0daa2192) 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg update 0dec01379d3b 0 files updated, 0 files merged, 0 files removed, 0 files unresolved 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 @@ -76,6 +76,7 @@ --------------- $ hg up 'desc(A0)' --hidden updating to a hidden changeset 471f378eab4c + (hidden revision '471f378eab4c' was rewritten as: d004c8f274b9) 1 files updated, 0 files merged, 0 files removed, 0 files unresolved Predecessors template should show current revision as it is the working copy @@ -148,6 +149,7 @@ $ hg up 'desc(A1)' --hidden updating to a hidden changeset a468dc9b3633 + (hidden revision 'a468dc9b3633' was rewritten as: d004c8f274b9) 1 files updated, 0 files merged, 0 files removed, 0 files unresolved Predecessors template should show current revision as it is the working copy @@ -416,6 +418,7 @@ $ hg up 'obsolete()' --hidden updating to a hidden changeset 471597cad322 + (hidden revision '471597cad322' was split as: 337fec4d2edc, f257fde29c7a) 0 files updated, 0 files merged, 0 files removed, 0 files unresolved Predecessors template should show current revision as it is the working copy @@ -624,6 +627,7 @@ $ hg up 'desc(A0)' --hidden updating to a hidden changeset 471f378eab4c + (hidden revision '471f378eab4c' was rewritten as: eb5a0daa2192) 0 files updated, 0 files merged, 1 files removed, 0 files unresolved Predecessors template should show current revision as it is the working copy @@ -649,6 +653,7 @@ $ hg up 'desc(B0)' --hidden updating to a hidden changeset 0dec01379d3b + (hidden revision '0dec01379d3b' was rewritten as: eb5a0daa2192) 1 files updated, 0 files merged, 0 files removed, 0 files unresolved Predecessors template should show both predecessors as they should be both @@ -815,6 +820,7 @@ $ hg update --hidden 'desc(A0)' updating to a hidden changeset 471f378eab4c + (hidden revision '471f378eab4c' was rewritten as: fdf9bde5129a) 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg commit --amend -m "A2" $ hg log --hidden -G @@ -887,6 +893,7 @@ $ hg up 'desc(A0)' --hidden updating to a hidden changeset 471f378eab4c + (hidden revision '471f378eab4c' has diverged) 0 files updated, 0 files merged, 0 files removed, 0 files unresolved Predecessors template should show current revision as it is the working copy @@ -1152,6 +1159,7 @@ $ hg up 'desc(A0)' --hidden updating to a hidden changeset 471f378eab4c + (hidden revision '471f378eab4c' was rewritten as: eb5a0daa2192) 0 files updated, 0 files merged, 1 files removed, 0 files unresolved Predecessors template should show current revision as it is the working copy @@ -1177,6 +1185,7 @@ $ hg up 'desc(B0)' --hidden updating to a hidden changeset 0dec01379d3b + (hidden revision '0dec01379d3b' was rewritten as: eb5a0daa2192) 1 files updated, 0 files merged, 0 files removed, 0 files unresolved Predecessors template should both predecessors as they are visible @@ -1208,6 +1217,7 @@ $ hg up 'desc(B1)' --hidden updating to a hidden changeset b7ea6d14e664 + (hidden revision 'b7ea6d14e664' was rewritten as: eb5a0daa2192) 0 files updated, 0 files merged, 0 files removed, 0 files unresolved Predecessors template should both predecessors as they are visible @@ -1610,6 +1620,7 @@ $ hg up -r "desc(B0)" --hidden updating to a hidden changeset 0dec01379d3b + (hidden revision '0dec01379d3b' is pruned) 2 files updated, 0 files merged, 1 files removed, 0 files unresolved $ hg tlog o f897c6137566 @@ -2071,6 +2082,7 @@ $ hg up --hidden 4 updating to a hidden changeset 9bd10a0775e4 + (hidden revision '9bd10a0775e4' has diverged) 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" @@ -2316,6 +2328,7 @@ $ hg up -r "desc(A0)" --hidden updating to a hidden changeset 471f378eab4c + (hidden revision '471f378eab4c' is pruned) 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg commit --amend -m "A2" $ hg debugobsolete --record-parent `getid "."` @@ -2326,6 +2339,7 @@ $ hg up "desc(A0)" --hidden updating to a hidden changeset 471f378eab4c + (hidden revision '471f378eab4c' is pruned) 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg tlog @ 471f378eab4c @@ -2480,6 +2494,7 @@ $ hg up 'desc("A0")' --hidden updating to a hidden changeset 471597cad322 + (hidden revision '471597cad322' is pruned) 0 files updated, 0 files merged, 0 files removed, 0 files unresolved # todo: the obsfate output is not ideal @@ -2492,6 +2507,7 @@ $ hg up -r 'desc("A2")' --hidden updating to a hidden changeset 0d0ef4bdf70e + (hidden revision '0d0ef4bdf70e' is pruned) 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 @@ -63,6 +63,7 @@ -1:000000000000 (public) [tip ] $ hg up --hidden tip --quiet updating to a hidden changeset 97b7c2d76b18 + (hidden revision '97b7c2d76b18' is pruned) 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 @@ -281,6 +281,7 @@ $ hg --hidden up -qr 'first(hidden())' updating to a hidden changeset 42ccdea3bb16 + (hidden revision '42ccdea3bb16' is pruned) $ hg rebase --rev 13 --dest 15 rebasing 13:98f6af4ee953 "C" $ hg log -G @@ -612,6 +613,7 @@ $ hg up --hidden 9 updating to a hidden changeset 4bde274eefcf + (hidden revision '4bde274eefcf' was rewritten as: acd174b7ab39) 3 files updated, 0 files merged, 1 files removed, 0 files unresolved $ echo J > J $ hg add J @@ -728,6 +730,7 @@ $ hg commit --amend -m B2 $ hg up --hidden 'desc(B0)' updating to a hidden changeset a8b11f55fb19 + (hidden revision 'a8b11f55fb19' was rewritten as: 261e70097290) 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ echo C > C $ hg add C @@ -752,6 +755,7 @@ $ hg up --hidden 'desc(B0)' updating to a hidden changeset a8b11f55fb19 + (hidden revision 'a8b11f55fb19' was rewritten as: 261e70097290) 0 files updated, 0 files merged, 1 files removed, 0 files unresolved $ echo D > D $ hg add D @@ -867,6 +871,7 @@ $ hg commit --amend -m "10'" $ hg up 10 --hidden updating to a hidden changeset 121d9e3bc4c6 + (hidden revision '121d9e3bc4c6' was rewritten as: 77d874d096a2) 0 files updated, 0 files merged, 1 files removed, 0 files unresolved $ echo "bar" > foo $ hg add foo @@ -1602,6 +1607,7 @@ $ hg update -q $C --hidden updating to a hidden changeset 7829726be4dc + (hidden revision '7829726be4dc' is pruned) $ 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 @@ -521,6 +521,7 @@ $ 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 + (hidden revision '6efa171f091b' was rewritten as: d047485b3896) $ hg book -f bm $ hg up 1 files updated, 0 files merged, 0 files removed, 0 files unresolved @@ -532,6 +533,7 @@ $ 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 + (hidden revision '6efa171f091b' was rewritten as: d047485b3896) $ hg up 5 1 files updated, 0 files merged, 0 files removed, 0 files unresolved