Gregory Szorc <gregory.szorc@gmail.com> [Sun, 04 Feb 2018 14:44:04 -0800] rev 35939
sshpeer: document the handshake mechanism
The mechanism by which SSH peers establish connections with remotes
is wonky and requires a bit of code archeology to understand. While
it is already documented in `hg help internals.wireproto`, it helps
to have documentation in the code as well.
Differential Revision: https://phab.mercurial-scm.org/D2035
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 05 Feb 2018 09:14:32 -0800] rev 35938
sshpeer: move handshake outside of sshpeer
With the handshake now performed before a peer class is instantiated,
we can now instantiate a different peer class depending on the results
of the handshake.
Our test extension had to change to cope with the new API. Because
we now issue the command via raw I/O calls and don't call
_callstream(), we no longer have to register the fake command.
(_callstream() uses the command registration to see what args to
send).
Differential Revision: https://phab.mercurial-scm.org/D2034
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 04 Feb 2018 14:10:56 -0800] rev 35937
sshpeer: inline I/O into _validaterepo()
We want to move the handshake code out of the peer class so the
peer factory function can perform the handshake and instantiate
a proper class depending on the results. To make that refactor
easier to read, we first inline I/O functionality into
_validaterepo().
Test output for low-level protocol tests didn't change, thus
hopefully demonstrating that this refactor didn't change any
material behavior.
Because we no longer call _callstream(), our test extension for
monkeypatching the peer had to change its hook point.
Differential Revision: https://phab.mercurial-scm.org/D2033
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 05 Feb 2018 14:17:24 -0800] rev 35936
sshpeer: clean up API for sshpeer.__init__ (API)
Our refactoring left the state of sshpeer.__init__ in a poor
state. "create" was no longer used. Process/pipe arguments were
passed poorly. "name" was really a URL.
This commit cleans all that up.
.. api::
sshpeer.sshpeer.__init__ now receives arguments describing an
existing connection instead of creating a connection itself.
Differential Revision: https://phab.mercurial-scm.org/D2032