Differential D18856 Diff 45236 src/applications/diffusion/ssh/DiffusionMercurialServeSSHWorkflow.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/ssh/DiffusionMercurialServeSSHWorkflow.php
Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | $protocol_channel = new DiffusionMercurialWireClientSSHProtocolChannel( | ||||
$io_channel); | $io_channel); | ||||
$err = id($this->newPassthruCommand()) | $err = id($this->newPassthruCommand()) | ||||
->setIOChannel($protocol_channel) | ->setIOChannel($protocol_channel) | ||||
->setCommandChannelFromExecFuture($future) | ->setCommandChannelFromExecFuture($future) | ||||
->setWillWriteCallback(array($this, 'willWriteMessageCallback')) | ->setWillWriteCallback(array($this, 'willWriteMessageCallback')) | ||||
->execute(); | ->execute(); | ||||
// TODO: It's apparently technically possible to communicate errors to | |||||
// Mercurial over SSH by writing a special "\n<error>\n-\n" string. However, | |||||
// my attempt to implement that resulted in Mercurial closing the socket and | |||||
// then hanging, without showing the error. This might be an issue on our | |||||
// side (we need to close our half of the socket?), or maybe the code | |||||
// for this in Mercurial doesn't actually work, or maybe something else | |||||
// is afoot. At some point, we should look into doing this more cleanly. | |||||
// For now, when we, e.g., reject writes for policy reasons, the user will | |||||
// see "abort: unexpected response: empty string" after the diagnostically | |||||
// useful, e.g., "remote: This repository is read-only over SSH." message. | |||||
if (!$err && $this->didSeeWrite) { | if (!$err && $this->didSeeWrite) { | ||||
$repository->writeStatusMessage( | $repository->writeStatusMessage( | ||||
PhabricatorRepositoryStatusMessage::TYPE_NEEDS_UPDATE, | PhabricatorRepositoryStatusMessage::TYPE_NEEDS_UPDATE, | ||||
PhabricatorRepositoryStatusMessage::CODE_OKAY); | PhabricatorRepositoryStatusMessage::CODE_OKAY); | ||||
} | } | ||||
return $err; | return $err; | ||||
} | } | ||||
Show All 38 Lines |