Merge branch 'svn-root-detection'
* svn-root-detection: Reformat code to follow coding style * added svn handling for tags, trunk, branches in root packagespull/2681/head
commit
b7a9ea4187
|
@ -179,7 +179,12 @@ class RootPackageLoader extends ArrayLoader
|
||||||
return $version;
|
return $version;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->guessHgVersion($config);
|
$version = $this->guessHgVersion($config);
|
||||||
|
if (null !== $version) {
|
||||||
|
return $version;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->guessSvnVersion($config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,4 +300,29 @@ class RootPackageLoader extends ArrayLoader
|
||||||
|
|
||||||
return $version;
|
return $version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function guessSvnVersion(array $config)
|
||||||
|
{
|
||||||
|
// try to fetch current version from svn
|
||||||
|
if (0 === $this->process->execute('svn info --xml', $output)) {
|
||||||
|
$trunkPath = isset($config['trunk-path']) ? preg_quote($config['trunk-path'], '#') : 'trunk';
|
||||||
|
$branchesPath = isset($config['branches-path']) ? preg_quote($config['branches-path'], '#') : 'branches';
|
||||||
|
$tagsPath = isset($config['tags-path']) ? preg_quote($config['tags-path'], '#') : 'tags';
|
||||||
|
|
||||||
|
$urlPattern = '#<url>.*/('.$trunkPath.'|('.$branchesPath.'|'. $tagsPath .')/(.*))</url>#';
|
||||||
|
|
||||||
|
if (preg_match($urlPattern, $output, $matches)) {
|
||||||
|
if (isset($matches[2]) && $branchesPath === $matches[2]) {
|
||||||
|
// we are in a branches path
|
||||||
|
$version = $this->versionParser->normalizeBranch($matches[3]);
|
||||||
|
if ('9999999-dev' === $version) {
|
||||||
|
$version = 'dev-'.$matches[3];
|
||||||
|
}
|
||||||
|
return $version;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->versionParser->normalize(trim($matches[1]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue