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
--- a/mercurial/commands.py Sun Jan 14 00:02:40 2018 -0800
+++ b/mercurial/commands.py Tue Jan 16 14:08:54 2018 +0100
@@ -43,6 +43,7 @@
lock as lockmod,
merge as mergemod,
obsolete,
+ obsutil,
patch,
phases,
pycompat,
@@ -5538,7 +5539,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')
--- a/tests/test-directaccess.t Sun Jan 14 00:02:40 2018 -0800
+++ b/tests/test-directaccess.t Tue Jan 16 14:08:54 2018 +0100
@@ -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
--- a/tests/test-log.t Sun Jan 14 00:02:40 2018 -0800
+++ b/tests/test-log.t Tue Jan 16 14:08:54 2018 +0100
@@ -1941,6 +1941,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
--- a/tests/test-obshistory.t Sun Jan 14 00:02:40 2018 -0800
+++ b/tests/test-obshistory.t Tue Jan 16 14:08:54 2018 +0100
@@ -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
@@ -370,6 +374,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!
@@ -377,6 +382,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
@@ -411,6 +417,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"
2 new content-divergent changesets
@@ -450,6 +457,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
@@ -544,9 +552,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
--- a/tests/test-obsmarker-template.t Sun Jan 14 00:02:40 2018 -0800
+++ b/tests/test-obsmarker-template.t Tue Jan 16 14:08:54 2018 +0100
@@ -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
@@ -625,6 +628,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
@@ -650,6 +654,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
@@ -816,6 +821,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"
2 new content-divergent changesets
@@ -889,6 +895,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
@@ -1155,6 +1162,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
@@ -1180,6 +1188,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
@@ -1211,6 +1220,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
@@ -1614,6 +1624,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
@@ -2077,6 +2088,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"
@@ -2322,6 +2334,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 "."`
@@ -2332,6 +2345,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
@@ -2486,6 +2500,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
@@ -2498,6 +2513,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
--- a/tests/test-obsolete.t Sun Jan 14 00:02:40 2018 -0800
+++ b/tests/test-obsolete.t Tue Jan 16 14:08:54 2018 +0100
@@ -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)
--- a/tests/test-rebase-obsolete.t Sun Jan 14 00:02:40 2018 -0800
+++ b/tests/test-rebase-obsolete.t Tue Jan 16 14:08:54 2018 +0100
@@ -282,6 +282,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
@@ -615,6 +616,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
@@ -736,6 +738,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
@@ -761,6 +764,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
@@ -878,6 +882,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
@@ -1633,6 +1638,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
--- a/tests/test-update-branches.t Sun Jan 14 00:02:40 2018 -0800
+++ b/tests/test-update-branches.t Tue Jan 16 14:08:54 2018 +0100
@@ -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