Mercurial > public > mercurial-scm > hg-stable
diff mercurial/sshpeer.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 | 45c7bada5200 |
line wrap: on
line diff
--- a/mercurial/sshpeer.py Sat Apr 13 01:17:56 2019 +0200 +++ b/mercurial/sshpeer.py Thu Apr 04 18:07:30 2019 +0200 @@ -372,7 +372,16 @@ class sshv1peer(wireprotov1peer.wirepeer): def __init__( - self, ui, path, proc, stdin, stdout, stderr, caps, autoreadstderr=True + self, + ui, + path, + proc, + stdin, + stdout, + stderr, + caps, + autoreadstderr=True, + remotehidden=False, ): """Create a peer from an existing SSH connection. @@ -383,7 +392,14 @@ ``autoreadstderr`` denotes whether to automatically read from stderr and to forward its output. """ - super().__init__(ui, path=path) + super().__init__(ui, path=path, remotehidden=remotehidden) + if remotehidden: + msg = _( + b"ignoring `--remote-hidden` request\n" + b"(access to hidden changeset for ssh peers not supported " + b"yet)\n" + ) + ui.warn(msg) # self._subprocess is unused. Keeping a handle on the process # holds a reference and prevents it from being garbage collected. self._subprocess = proc @@ -568,7 +584,16 @@ self._readerr() -def _make_peer(ui, path, proc, stdin, stdout, stderr, autoreadstderr=True): +def _make_peer( + ui, + path, + proc, + stdin, + stdout, + stderr, + autoreadstderr=True, + remotehidden=False, +): """Make a peer instance from existing pipes. ``path`` and ``proc`` are stored on the eventual peer instance and may @@ -598,6 +623,7 @@ stderr, caps, autoreadstderr=autoreadstderr, + remotehidden=remotehidden, ) else: _cleanuppipes(ui, stdout, stdin, stderr, warn=None) @@ -606,7 +632,9 @@ ) -def make_peer(ui, path, create, intents=None, createopts=None): +def make_peer( + ui, path, create, intents=None, createopts=None, remotehidden=False +): """Create an SSH peer. The returned object conforms to the ``wireprotov1peer.wirepeer`` interface. @@ -658,7 +686,9 @@ ui, sshcmd, args, remotecmd, remotepath, sshenv ) - peer = _make_peer(ui, path, proc, stdin, stdout, stderr) + peer = _make_peer( + ui, path, proc, stdin, stdout, stderr, remotehidden=remotehidden + ) # Finally, if supported by the server, notify it about our own # capabilities.