Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/ssh/DiffusionGitSSHWorkflow.php
<?php | <?php | ||||
abstract class DiffusionGitSSHWorkflow | abstract class DiffusionGitSSHWorkflow | ||||
extends DiffusionSSHWorkflow | extends DiffusionSSHWorkflow | ||||
implements DiffusionRepositoryClusterEngineLogInterface { | implements DiffusionRepositoryClusterEngineLogInterface { | ||||
private $engineLogProperties = array(); | private $engineLogProperties = array(); | ||||
private $protocolLog; | |||||
protected function writeError($message) { | protected function writeError($message) { | ||||
// Git assumes we'll add our own newlines. | // Git assumes we'll add our own newlines. | ||||
return parent::writeError($message."\n"); | return parent::writeError($message."\n"); | ||||
} | } | ||||
public function writeClusterEngineLogMessage($message) { | public function writeClusterEngineLogMessage($message) { | ||||
parent::writeError($message); | parent::writeError($message); | ||||
Show All 34 Lines | protected function raiseWrongVCSException( | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'This repository ("%s") is not a Git repository. Use "%s" to '. | 'This repository ("%s") is not a Git repository. Use "%s" to '. | ||||
'interact with this repository.', | 'interact with this repository.', | ||||
$repository->getDisplayName(), | $repository->getDisplayName(), | ||||
$repository->getVersionControlSystem())); | $repository->getVersionControlSystem())); | ||||
} | } | ||||
protected function newPassthruCommand() { | |||||
return parent::newPassthruCommand() | |||||
->setWillWriteCallback(array($this, 'willWriteMessageCallback')) | |||||
->setWillReadCallback(array($this, 'willReadMessageCallback')); | |||||
} | |||||
protected function newProtocolLog($is_proxy) { | |||||
if ($is_proxy) { | |||||
return null; | |||||
} | |||||
// While developing, do this to write a full protocol log to disk: | |||||
// | |||||
// return new PhabricatorProtocolLog('/tmp/git-protocol.log'); | |||||
return null; | |||||
} | |||||
protected function getProtocolLog() { | |||||
return $this->protocolLog; | |||||
} | |||||
protected function setProtocolLog(PhabricatorProtocolLog $log) { | |||||
$this->protocolLog = $log; | |||||
} | |||||
public function willWriteMessageCallback( | |||||
PhabricatorSSHPassthruCommand $command, | |||||
$message) { | |||||
$log = $this->getProtocolLog(); | |||||
if ($log) { | |||||
$log->didWriteBytes($message); | |||||
} | |||||
return $message; | |||||
} | |||||
public function willReadMessageCallback( | |||||
PhabricatorSSHPassthruCommand $command, | |||||
$message) { | |||||
$log = $this->getProtocolLog(); | |||||
if ($log) { | |||||
$log->didReadBytes($message); | |||||
} | |||||
return $message; | |||||
} | |||||
} | } |