Improve 'getTags()' and 'getBranches()'
parent
c7dc49fe10
commit
80bb040468
|
@ -198,14 +198,17 @@ class SvnDriver extends VcsDriver
|
||||||
public function getTags()
|
public function getTags()
|
||||||
{
|
{
|
||||||
if (null === $this->tags) {
|
if (null === $this->tags) {
|
||||||
$output = $this->execute('svn ls', $this->baseUrl . '/tags');
|
|
||||||
$this->tags = array();
|
$this->tags = array();
|
||||||
|
|
||||||
|
$output = $this->execute('svn ls', $this->baseUrl . '/tags');
|
||||||
|
if ($output) {
|
||||||
foreach ($this->process->splitLines($output) as $tag) {
|
foreach ($this->process->splitLines($output) as $tag) {
|
||||||
if ($tag) {
|
if ($tag) {
|
||||||
$this->tags[rtrim($tag, '/')] = '/tags/'.$tag;
|
$this->tags[rtrim($tag, '/')] = '/tags/'.$tag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $this->tags;
|
return $this->tags;
|
||||||
}
|
}
|
||||||
|
@ -216,27 +219,34 @@ class SvnDriver extends VcsDriver
|
||||||
public function getBranches()
|
public function getBranches()
|
||||||
{
|
{
|
||||||
if (null === $this->branches) {
|
if (null === $this->branches) {
|
||||||
$output = $this->execute('svn ls --verbose', $this->baseUrl . '/');
|
|
||||||
$this->branches = array();
|
$this->branches = array();
|
||||||
|
|
||||||
|
$output = $this->execute('svn ls --verbose', $this->baseUrl . '/');
|
||||||
|
if ($output) {
|
||||||
foreach ($this->process->splitLines($output) as $line) {
|
foreach ($this->process->splitLines($output) as $line) {
|
||||||
preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match);
|
$line = trim($line);
|
||||||
if ($match[2] === 'trunk/') {
|
if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
|
||||||
|
if (isset($match[1]) && isset($match[2]) && $match[2] === 'trunk/') {
|
||||||
$this->branches['trunk'] = '/trunk/@'.$match[1];
|
$this->branches['trunk'] = '/trunk/@'.$match[1];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
unset($output);
|
unset($output);
|
||||||
|
|
||||||
$output = $this->execute('svn ls --verbose', $this->baseUrl . '/branches');
|
$output = $this->execute('svn ls --verbose', $this->baseUrl . '/branches');
|
||||||
|
if ($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);
|
$line = trim($line);
|
||||||
if ($match[2] === './') {
|
if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
|
||||||
continue;
|
if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
|
||||||
}
|
|
||||||
$this->branches[rtrim($match[2], '/')] = '/branches/'.$match[2].'@'.$match[1];
|
$this->branches[rtrim($match[2], '/')] = '/branches/'.$match[2].'@'.$match[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $this->branches;
|
return $this->branches;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue