# HG changeset patch # User Boris Feld # Date 2018-01-16 13:08:54 # Node ID 35a0f6f31eefa75d6d0aa280698f2010daad9bb4 # Parent 5cd60b0587a8e8371b0499ba65911180c4d6e4ae update: display the obsfate of hidden revision we update to Display the same message we added recently to the filtered error message when updating to a hidden obsolete changeset. Differential Revision: https://phab.mercurial-scm.org/D1869 diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -43,6 +43,7 @@ from . import ( lock as lockmod, merge as mergemod, obsolete, + obsutil, patch, phases, pycompat, @@ -5538,7 +5539,12 @@ def update(ui, repo, node=None, rev=None 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 @@ This should not throw error $ 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 @@ -1941,6 +1941,7 @@ test that parent prevent a changeset to $ 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 @@ Actual test [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 @@ Actual test [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 @@ Actual test [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 @@ Actual test [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 @@ -370,6 +374,7 @@ Test setup [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! @@ -377,6 +382,7 @@ Test setup [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 @@ -411,6 +417,7 @@ Test setup $ 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" 2 new content-divergent changesets @@ -450,6 +457,7 @@ Actual test [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 @@ -544,9 +552,11 @@ Test setup [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 @@ Check templates --------------- $ 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 @@ Predecessors template should show curren $ 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 @@ Check templates $ 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 @@ -625,6 +628,7 @@ Check templates $ 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 @@ -650,6 +654,7 @@ Predecessors template should show curren $ 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 @@ -816,6 +821,7 @@ Test setup $ 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" 2 new content-divergent changesets @@ -889,6 +895,7 @@ Check templates $ 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 @@ -1155,6 +1162,7 @@ Check templates $ 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 @@ -1180,6 +1188,7 @@ Predecessors template should show curren $ 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 @@ -1211,6 +1220,7 @@ Predecessors template should both predec $ 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 @@ -1614,6 +1624,7 @@ Check templates $ 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 @@ -2077,6 +2088,7 @@ Check templates $ 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" @@ -2322,6 +2334,7 @@ Test setup $ 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 "."` @@ -2332,6 +2345,7 @@ Check output $ 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 @@ -2486,6 +2500,7 @@ Check templates $ 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 @@ -2498,6 +2513,7 @@ Check templates $ 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 @@ Killing a single changeset without repla -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 @@ -282,6 +282,7 @@ even though it is hidden (until we're mo $ 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 @@ -615,6 +616,7 @@ Test hidden changesets in the rebase set $ 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 @@ -736,6 +738,7 @@ setup $ 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 @@ -761,6 +764,7 @@ Even when the chain include missing node $ 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 @@ -878,6 +882,7 @@ If a rebase is going to create divergenc $ 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 @@ -1633,6 +1638,7 @@ rebasestate may contain hidden hashes. " $ 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 @@ 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 + (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 @@ Test that 5 is detected as a valid desti $ 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