( )⚙ D2031 sshpeer: establish SSH connection before class instantiation

This is an archive of the discontinued Mercurial Phabricator instance.

sshpeer: establish SSH connection before class instantiation
ClosedPublic

Authored by indygreg on Feb 4 2018, 10:35 PM.

Details

Summary

We want to move the handshake to before peers are created so
we can instantiate a different peer class depending on the
results of the handshake. This necessitates moving the SSH
process invocation to outside the peer class.

As part of the code move, some variables were renamed for
clarity. util.popen4() returns stdin, stdout, and stderr in
their typical file descriptor order. However, stdin and stdout
were being mapped to "pipeo" and "pipei" respectively. "o"
for "stdin" and "i" for "stdout" is a bit confusing. Although
it does make sense for "output" and "input" from the perspective
of the client. But in the context of the new function, it makes
sense to refer to these as their file descriptor names.

In addition, the last use of self._path disappeared, so we stop
setting that attribute and we can delete the redundant URL
parsing necessary to set it.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

indygreg created this revision.Feb 4 2018, 10:35 PM
lothiraldan accepted this revision.Feb 5 2018, 8:12 AM
indygreg edited the summary of this revision. (Show Details)Feb 5 2018, 5:21 PM
indygreg updated this revision to Diff 5232.
yuja accepted this revision.Feb 6 2018, 8:07 AM
This revision is now accepted and ready to land.Feb 6 2018, 8:07 AM
This revision was automatically updated to reflect the committed changes.