Patchwork D1813: bookmarks: add bookmarks to hidden revs if directaccess config is set

login
register
mail settings
Submitter phabricator
Date Jan. 10, 2018, 5:48 p.m.
Message ID <2afd65a2ae583096afaeb4f01fc18420@localhost.localdomain>
Download mbox | patch
Permalink /patch/26639/
State Not Applicable
Headers show

Comments

phabricator - Jan. 10, 2018, 5:48 p.m.
pulkit updated this revision to Diff 4754.
pulkit edited the summary of this revision.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1813?vs=4732&id=4754

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

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: pulkit, #hg-reviewers, yuja
Cc: yuja, 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
@@ -1496,6 +1496,7 @@ 
   $ hg log -r .  # working dir is at rev 3 (successor of 2)
   3:be1832deae9a b (no-eol)
   $ hg book -r 2 mybook --hidden  # rev 2 has a bookmark on it now
+  accessing hidden changeset 1e9a3c00cbe9
   $ 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
@@ -1333,6 +1333,7 @@ 
   $ echo "hello" > b
   $ hg commit --amend -m "message"
   $ hg book bookb -r 13bedc178fce --hidden
+  accessing hidden changeset 13bedc178fce
   $ 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
@@ -1851,14 +1851,16 @@ 
 bookmarks prevent a changeset being hidden
 
   $ hg bookmark --hidden -r 1 X
+  accessing hidden changeset a765632148dc
   $ hg log --template '{rev}:{node}\n'
   1:a765632148dc55d38c35c4f247c618701886cb2f
   0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
   $ hg bookmark -d X
 
 divergent bookmarks are not hidden
 
   $ hg bookmark --hidden -r 1 X@foo
+  accessing hidden changeset a765632148dc
   $ 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
@@ -186,3 +186,11 @@ 
   abort: hidden revision '2'!
   (use --hidden to access hidden revisions)
   [255]
+
+Setting a bookmark will make that changeset unhidden, so this should come in end
+
+  $ hg bookmarks -r 28ad74 book
+  accessing hidden changeset 28ad74487de9
+
+  $ hg bookmarks
+     book                      2:28ad74487de9
diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -853,7 +853,11 @@ 
             return
         tgt = cur
         if rev:
-            tgt = scmutil.revsingle(repo, rev).node()
+            repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn')
+            ctx = scmutil.revsingle(repo, rev)
+            if ctx.hidden():
+                repo.ui.warn(_("accessing hidden changeset %s\n") % ctx)
+            tgt = ctx.node()
         for bm in marks.checkconflict(mark, force, tgt):
             changes.append((bm, None))
         changes.append((mark, tgt))