protected function callSvn(string $action, string $user, string $password, array $params) : Result
{
try {
$command = escapeshellcmd($this->svnBinary) . ' ' . escapeshellarg($action);
$command .= $this->getUserString($user);
$command .= $this->getPasswordString($password);
switch ($action) {
case 'add':
case 'delete':
$command .= $this->getAdditionalParams($params, true);
break;
default:
$command .= $this->getAdditionalParams($params, false);
break;
}
try {
$shell = new \Jyxo\Shell\Client();
$shell->exec($command, $status);
return new Result($action, $shell->getOut(), $status);
} catch (\Jyxo\Shell\Exception $e) {
throw $e;
}
} catch (\Exception $e) {
throw new Exception(sprintf('SVN %s failed: %s', $action, $e->getMessage()), 0, $e);
}
}