Mercurial > public > mercurial-scm > hg-stable
diff mercurial/httppeer.py @ 50474:3a2df812e1c7
pull: add --remote-hidden option and pass it through peer creation
This option will allow to pull changesets that are hidden on the remote. This
is useful when looking into a changeset?s evolution history, resolving
evolution instability or mirroring a repository.
The option is best effort and will only affect the pull when it can. The option
will be ignored when it cannot be honored.
Support for each type of peer is yet to be implemented. They currently all warn
about lack of support. The warning code will get removed as peers gain
support for this option.
The option is still experimental, so we will have freedom to update the UI or
implementation before it graduates out of experimental.
Based on a changeset by Pierre-Yves David, which added the option.
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Thu, 04 Apr 2019 18:07:30 +0200 |
parents | ed052780ad5e |
children | 315f537627c1 |
line wrap: on
line diff
--- a/mercurial/httppeer.py Sat Apr 13 01:17:56 2019 +0200 +++ b/mercurial/httppeer.py Thu Apr 04 18:07:30 2019 +0200 @@ -381,8 +381,17 @@ class httppeer(wireprotov1peer.wirepeer): - def __init__(self, ui, path, url, opener, requestbuilder, caps): - super().__init__(ui, path=path) + def __init__( + self, ui, path, url, opener, requestbuilder, caps, remotehidden=False + ): + super().__init__(ui, path=path, remotehidden=remotehidden) + if remotehidden: + msg = _( + b"ignoring `--remote-hidden` request\n" + b"(access to hidden changeset for http peers not " + b"supported yet)\n" + ) + ui.warn(msg) self._url = url self._caps = caps self.limitedarguments = caps is not None and b'httppostargs' not in caps @@ -592,7 +601,9 @@ return respurl, info -def _make_peer(ui, path, opener=None, requestbuilder=urlreq.request): +def _make_peer( + ui, path, opener=None, requestbuilder=urlreq.request, remotehidden=False +): """Construct an appropriate HTTP peer instance. ``opener`` is an ``url.opener`` that should be used to establish @@ -615,11 +626,19 @@ respurl, info = performhandshake(ui, url, opener, requestbuilder) return httppeer( - ui, path, respurl, opener, requestbuilder, info[b'v1capabilities'] + ui, + path, + respurl, + opener, + requestbuilder, + info[b'v1capabilities'], + remotehidden=remotehidden, ) -def make_peer(ui, path, create, intents=None, createopts=None): +def make_peer( + ui, path, create, intents=None, createopts=None, remotehidden=False +): if create: raise error.Abort(_(b'cannot create new http repository')) try: @@ -628,7 +647,7 @@ _(b'Python support for SSL and HTTPS is not installed') ) - inst = _make_peer(ui, path) + inst = _make_peer(ui, path, remotehidden=remotehidden) return inst except error.RepoError as httpexception: