From 5b24a48827a3d6fca8ce53d71956ad8f725196ae Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sat, 8 Dec 2012 17:41:21 +0100 Subject: [PATCH] Allow disabling svn branches/tags, fixes composer/satis#43 --- doc/05-repositories.md | 3 ++ src/Composer/Repository/Vcs/SvnDriver.php | 36 +++++++++++++---------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/doc/05-repositories.md b/doc/05-repositories.md index 9d3be231c..17eaf039d 100644 --- a/doc/05-repositories.md +++ b/doc/05-repositories.md @@ -259,6 +259,9 @@ repository like this: ] } +If you have no branches or tags directory you can disable them entirely by +setting the `branches-path` or `tags-path` to `false`. + ### PEAR It is possible to install packages from any PEAR channel by using the `pear` diff --git a/src/Composer/Repository/Vcs/SvnDriver.php b/src/Composer/Repository/Vcs/SvnDriver.php index 7b3cae73f..af42c1f9b 100755 --- a/src/Composer/Repository/Vcs/SvnDriver.php +++ b/src/Composer/Repository/Vcs/SvnDriver.php @@ -160,14 +160,16 @@ class SvnDriver extends VcsDriver if (null === $this->tags) { $this->tags = array(); - $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->tagsPath); - if ($output) { - foreach ($this->process->splitLines($output) as $line) { - $line = trim($line); - if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) { - if (isset($match[1]) && isset($match[2]) && $match[2] !== './') { - $this->tags[rtrim($match[2], '/')] = '/' . $this->tagsPath . - '/' . $match[2] . '@' . $match[1]; + if ($this->tagsPath !== false) { + $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->tagsPath); + if ($output) { + foreach ($this->process->splitLines($output) as $line) { + $line = trim($line); + if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) { + if (isset($match[1]) && isset($match[2]) && $match[2] !== './') { + $this->tags[rtrim($match[2], '/')] = '/' . $this->tagsPath . + '/' . $match[2] . '@' . $match[1]; + } } } } @@ -200,14 +202,16 @@ class SvnDriver extends VcsDriver } unset($output); - $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->branchesPath); - if ($output) { - foreach ($this->process->splitLines(trim($output)) as $line) { - $line = trim($line); - if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) { - if (isset($match[1]) && isset($match[2]) && $match[2] !== './') { - $this->branches[rtrim($match[2], '/')] = '/' . $this->branchesPath . - '/' . $match[2] . '@' . $match[1]; + if ($this->branchesPath !== false) { + $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->branchesPath); + if ($output) { + foreach ($this->process->splitLines(trim($output)) as $line) { + $line = trim($line); + if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) { + if (isset($match[1]) && isset($match[2]) && $match[2] !== './') { + $this->branches[rtrim($match[2], '/')] = '/' . $this->branchesPath . + '/' . $match[2] . '@' . $match[1]; + } } } }