* wrap execution of commands into local method
parent
99eb18d0ff
commit
907db48bb5
|
@ -52,6 +52,25 @@ class SvnDriver extends VcsDriver implements VcsDriverInterface
|
||||||
$this->detectSvnAuth();
|
$this->detectSvnAuth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute an SVN command and try to fix up the process with credentials
|
||||||
|
* if necessary.
|
||||||
|
*
|
||||||
|
* @param string $command The svn command to run.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @uses parent::$process
|
||||||
|
* @see ProcessExecutor::execute()
|
||||||
|
*/
|
||||||
|
public function execute($command)
|
||||||
|
{
|
||||||
|
$status = $this->process->execute(
|
||||||
|
$command,
|
||||||
|
$output
|
||||||
|
);
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
@ -108,9 +127,8 @@ class SvnDriver extends VcsDriver implements VcsDriverInterface
|
||||||
$rev = '';
|
$rev = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->process->execute(
|
$output = $this->execute(
|
||||||
$this->getSvnCommand('svn cat', $this->baseUrl . $identifier . 'composer.json' . $rev),
|
$this->getSvnCommand('svn cat', $this->baseUrl . $identifier . 'composer.json' . $rev)
|
||||||
$output
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!trim($output)) {
|
if (!trim($output)) {
|
||||||
|
@ -122,9 +140,8 @@ class SvnDriver extends VcsDriver implements VcsDriverInterface
|
||||||
$composer = JsonFile::parseJson($output);
|
$composer = JsonFile::parseJson($output);
|
||||||
|
|
||||||
if (!isset($composer['time'])) {
|
if (!isset($composer['time'])) {
|
||||||
$this->process->execute(
|
$output = $this->execute(
|
||||||
$this->getSvnCommand('svn info', $this->baseUrl . $identifier . $rev),
|
$this->getSvnCommand('svn info', $this->baseUrl . $identifier . $rev)
|
||||||
$output
|
|
||||||
);
|
);
|
||||||
foreach ($this->process->splitLines($output) as $line) {
|
foreach ($this->process->splitLines($output) as $line) {
|
||||||
if ($line && preg_match('{^Last Changed Date: ([^(]+)}', $line, $match)) {
|
if ($line && preg_match('{^Last Changed Date: ([^(]+)}', $line, $match)) {
|
||||||
|
@ -146,9 +163,8 @@ class SvnDriver extends VcsDriver implements VcsDriverInterface
|
||||||
public function getTags()
|
public function getTags()
|
||||||
{
|
{
|
||||||
if (null === $this->tags) {
|
if (null === $this->tags) {
|
||||||
$this->process->execute(
|
$output = $this->execute(
|
||||||
$this->getSvnCommand('svn ls', $this->baseUrl . '/tags'),
|
$this->getSvnCommand('svn ls', $this->baseUrl . '/tags')
|
||||||
$output
|
|
||||||
);
|
);
|
||||||
$this->tags = array();
|
$this->tags = array();
|
||||||
foreach ($this->process->splitLines($output) as $tag) {
|
foreach ($this->process->splitLines($output) as $tag) {
|
||||||
|
@ -167,9 +183,8 @@ class SvnDriver extends VcsDriver implements VcsDriverInterface
|
||||||
public function getBranches()
|
public function getBranches()
|
||||||
{
|
{
|
||||||
if (null === $this->branches) {
|
if (null === $this->branches) {
|
||||||
$this->process->execute(
|
$output = $this->execute(
|
||||||
$this->getSvnCommand('svn ls --verbose', $this->baseUrl . '/'),
|
$this->getSvnCommand('svn ls --verbose', $this->baseUrl . '/')
|
||||||
$output
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->branches = array();
|
$this->branches = array();
|
||||||
|
@ -182,9 +197,8 @@ class SvnDriver extends VcsDriver implements VcsDriverInterface
|
||||||
}
|
}
|
||||||
unset($output);
|
unset($output);
|
||||||
|
|
||||||
$this->process->execute(
|
$output = $this->execute(
|
||||||
$this->getSvnCommand('svn ls --verbose', $this->baseUrl . '/branches'),
|
$this->getSvnCommand('svn ls --verbose', $this->baseUrl . '/branches')
|
||||||
$output
|
|
||||||
);
|
);
|
||||||
foreach ($this->process->splitLines(trim($output)) as $line) {
|
foreach ($this->process->splitLines(trim($output)) as $line) {
|
||||||
preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match);
|
preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match);
|
||||||
|
@ -295,7 +309,7 @@ class SvnDriver extends VcsDriver implements VcsDriverInterface
|
||||||
|
|
||||||
$exit = $processExecutor->execute(
|
$exit = $processExecutor->execute(
|
||||||
$this->getSvnCommand('svn info', $url, '2>/dev/null'),
|
$this->getSvnCommand('svn info', $url, '2>/dev/null'),
|
||||||
$ignored
|
$ignoredOutput
|
||||||
);
|
);
|
||||||
return $exit === 0;
|
return $exit === 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue