Patchwork D1870: bookmarks: display the obsfate of hidden revision we create a bookmark on

login
register
mail settings
Submitter phabricator
Date Jan. 17, 2018, 11:41 a.m.
Message ID <differential-rev-PHID-DREV-irqz6vsybkolwls75pbu-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/26810/
State Superseded
Headers show

Comments

phabricator - Jan. 17, 2018, 11:41 a.m.
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Display the same message we added recently to the filtered error message
  create a bookmark on an hidden revision.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1870

AFFECTED FILES
  mercurial/bookmarks.py
  tests/test-directaccess.t
  tests/test-log.t
  tests/test-obsolete.t
  tests/test-rebase-obsolete.t

CHANGE DETAILS




To: lothiraldan, #hg-reviewers
Cc: mercurial-devel

Patch

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
@@ -1502,6 +1502,7 @@ 
   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)
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -1335,6 +1335,7 @@ 
   $ 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-log.t b/tests/test-log.t
--- a/tests/test-log.t
+++ b/tests/test-log.t
@@ -1853,6 +1853,7 @@ 
 
   $ 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
@@ -1862,6 +1863,7 @@ 
 
   $ 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-directaccess.t b/tests/test-directaccess.t
--- a/tests/test-directaccess.t
+++ b/tests/test-directaccess.t
@@ -192,6 +192,7 @@ 
 
   $ hg bookmarks -r 28ad74 book
   bookmarking hidden changeset 28ad74487de9
+  (hidden revision '28ad74487de9' was rewritten as: 2443a0e66469)
 
   $ hg bookmarks
      book                      2:28ad74487de9
diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -855,6 +855,11 @@ 
 
     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)