1
0
Fork 0

Refactor code so it works cross-platform, refs #2825

pull/2852/merge
Jordi Boggiano 2014-03-29 14:16:13 +01:00
parent 01bf61fede
commit 07b8fe8109
1 changed files with 6 additions and 4 deletions

View File

@ -47,13 +47,15 @@ class SvnDownloader extends VcsDownloader
throw new \RuntimeException('The .svn directory is missing from '.$path.', see http://getcomposer.org/commit-deps for more information'); throw new \RuntimeException('The .svn directory is missing from '.$path.', see http://getcomposer.org/commit-deps for more information');
} }
$ignoreAncestryCommand = ""; $flags = "";
if ((int)$this->process->execute("svn --version | egrep 'version [0-9\.]+' -o | tr -d 'version .'") >= 170) { if (0 === $this->process->execute('svn --version', $output)) {
$ignoreAncestryCommand = " --ignore-ancestry"; if (preg_match('{(\d+(?:\.\d+)+)}', $output, $match) && version_compare($match[1], '1.7.0', '>=')) {
$flags .= ' --ignore-ancestry';
}
} }
$this->io->write(" Checking out " . $ref); $this->io->write(" Checking out " . $ref);
$this->execute($url, "svn switch" . $ignoreAncestry, sprintf("%s/%s", $url, $ref), $path); $this->execute($url, "svn switch" . $flags, sprintf("%s/%s", $url, $ref), $path);
} }
/** /**