# HG changeset patch # User Boris Feld # Date 2018-01-16 13:28:57 # Node ID a1a5c3842b6f11c5f9eb4c9c55ada2d211e389a0 # Parent 35a0f6f31eefa75d6d0aa280698f2010daad9bb4 bookmarks: display the obsfate of hidden revision we create a bookmark on Display the same message we added recently to the filtered error message create a bookmark on an hidden revision. Differential Revision: https://phab.mercurial-scm.org/D1870 diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py --- a/mercurial/bookmarks.py +++ b/mercurial/bookmarks.py @@ -861,6 +861,11 @@ def addbookmarks(repo, tr, names, rev=No if hiddenrev: repo.ui.warn(_("bookmarking hidden changeset %s\n") % hiddenrev) + + if ctx.obsolete(): + msg = obsutil._getfilteredreason(repo, "%s" % hiddenrev, ctx) + repo.ui.warn("(%s)\n" % msg) + marks.applychanges(repo, tr, changes) if not inactive and cur == marks[newact] and not rev: activate(repo, newact) diff --git a/tests/test-directaccess.t b/tests/test-directaccess.t --- a/tests/test-directaccess.t +++ b/tests/test-directaccess.t @@ -195,6 +195,7 @@ Setting a bookmark will make that change $ hg bookmarks -r 28ad74 book bookmarking hidden changeset 28ad74487de9 + (hidden revision '28ad74487de9' was rewritten as: 2443a0e66469) $ hg bookmarks book 2:28ad74487de9 diff --git a/tests/test-log.t b/tests/test-log.t --- a/tests/test-log.t +++ b/tests/test-log.t @@ -1959,6 +1959,7 @@ bookmarks prevent a changeset being hidd $ hg bookmark --hidden -r 1 X bookmarking hidden changeset a765632148dc + (hidden revision 'a765632148dc' is pruned) $ hg log --template '{rev}:{node}\n' 1:a765632148dc55d38c35c4f247c618701886cb2f 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05 @@ -1968,6 +1969,7 @@ divergent bookmarks are not hidden $ hg bookmark --hidden -r 1 X@foo bookmarking hidden changeset a765632148dc + (hidden revision 'a765632148dc' is pruned) $ hg log --template '{rev}:{node}\n' 1:a765632148dc55d38c35c4f247c618701886cb2f 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05 diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t --- a/tests/test-obsolete.t +++ b/tests/test-obsolete.t @@ -1352,6 +1352,7 @@ bookmarks change $ hg commit --amend -m "message" $ hg book bookb -r 13bedc178fce --hidden bookmarking hidden changeset 13bedc178fce + (hidden revision '13bedc178fce' was rewritten as: a9b1f8652753) $ hg log -r 13bedc178fce 4:13bedc178fce (draft *obsolete*) [ bookb] add b [rewritten using amend as 5:a9b1f8652753] $ hg book -d bookb 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 @@ -1531,6 +1531,7 @@ equivalents in destination 3:be1832deae9a b (no-eol) $ hg book -r 2 mybook --hidden # rev 2 has a bookmark on it now bookmarking hidden changeset 1e9a3c00cbe9 + (hidden revision '1e9a3c00cbe9' was rewritten as: be1832deae9a) $ hg up 2 && hg log -r . # working dir is at rev 2 again 0 files updated, 0 files merged, 1 files removed, 0 files unresolved 2:1e9a3c00cbe9 b (rewritten using rebase as 3:be1832deae9a) (no-eol)