--- a/mercurial/localrepo.py Thu Apr 04 18:07:30 2019 +0200
+++ b/mercurial/localrepo.py Fri Apr 05 12:11:52 2019 +0200
@@ -312,18 +312,12 @@
repo.ui, path=path, remotehidden=remotehidden
)
- if remotehidden:
- msg = _(
- b"ignoring `--remote-hidden` request\n"
- b"(access to hidden changeset for %r not "
- b"supported yet)\n"
- ) % type(self)
- self.ui.warn(msg)
-
if caps is None:
caps = moderncaps.copy()
- self._repo = repo.filtered(b'served')
-
+ if remotehidden:
+ self._repo = repo.filtered(b'served.hidden')
+ else:
+ self._repo = repo.filtered(b'served')
if repo._wanted_sidedata:
formatted = bundle2.format_remote_wanted_sidedata(repo)
caps.add(b'exp-wanted-sidedata=' + formatted)
--- a/tests/test-remote-hidden.t Thu Apr 04 18:07:30 2019 +0200
+++ b/tests/test-remote-hidden.t Fri Apr 05 12:11:52 2019 +0200
@@ -112,6 +112,67 @@
$ killdaemons.py
+Test --remote-hidden for local peer
+-----------------------------------
+
+ $ hg clone --pull repo-with-hidden client
+ requesting all changes
+ adding changesets
+ adding manifests
+ adding file changes
+ added 2 changesets with 2 changes to 1 files
+ 2 new obsolescence markers
+ new changesets 5f354f46e585:c33affeb3f6b (1 drafts)
+ updating to branch default
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ hg -R client log -G --hidden -v
+ @ 1:c33affeb3f6b c_Amend_New [draft]
+ |
+ o 0:5f354f46e585 c_Public [public]
+
+
+pulling an hidden changeset should fail:
+
+ $ hg -R client pull -r be215fbb8c50
+ pulling from $TESTTMP/repo-with-hidden
+ abort: filtered revision 'be215fbb8c50' (not in 'served' subset)
+ [10]
+
+pulling an hidden changeset with --remote-hidden should succeed:
+
+ $ hg -R client pull --remote-hidden --traceback -r be215fbb8c50
+ pulling from $TESTTMP/repo-with-hidden
+ searching for changes
+ adding changesets
+ adding manifests
+ adding file changes
+ added 1 changesets with 1 changes to 1 files (+1 heads)
+ (1 other changesets obsolete on arrival)
+ (run 'hg heads' to see heads)
+ $ hg -R client log -G --hidden -v
+ x 2:be215fbb8c50 c_Amend_Old [draft]
+ |
+ | @ 1:c33affeb3f6b c_Amend_New [draft]
+ |/
+ o 0:5f354f46e585 c_Public [public]
+
+
+Pulling a secret changeset is still forbidden:
+
+secret visible:
+
+ $ hg -R client pull --remote-hidden -r 8d28cbe335f3
+ pulling from $TESTTMP/repo-with-hidden
+ abort: filtered revision '8d28cbe335f3' (not in 'served.hidden' subset)
+ [10]
+
+secret hidden:
+
+ $ hg -R client pull --remote-hidden -r 1c6afd79eb66
+ pulling from $TESTTMP/repo-with-hidden
+ abort: filtered revision '1c6afd79eb66' (not in 'served.hidden' subset)
+ [10]
+
Test accessing hidden changeset through hgweb
---------------------------------------------