diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -312,18 +312,12 @@ class localpeer(repository.peer): 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) diff --git a/tests/test-remote-hidden.t b/tests/test-remote-hidden.t --- a/tests/test-remote-hidden.t +++ b/tests/test-remote-hidden.t @@ -112,6 +112,67 @@ changesets in secret and higher phases a $ 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 ---------------------------------------------