looks like svn 1.8 changed output of svn log --xml a bit, using now paths->path to identify tag

This commit is contained in:
Ralf Becker 2016-06-02 14:18:59 +02:00
parent 5d24bc2ab7
commit 28e3c78ee2

View File

@ -508,10 +508,9 @@ function do_editchangelog()
} }
// query changelog per repo // query changelog per repo
$changelog = ''; $changelog = '';
$last_tag = null; $last_tag = $revision = null;
foreach($config['modules'] as $branch_url => $modules) foreach($config['modules'] as $branch_url => $modules)
{ {
$revision = null;
if (substr($branch_url, -4) == '.git') if (substr($branch_url, -4) == '.git')
{ {
list($path) = each($modules); list($path) = each($modules);
@ -579,7 +578,7 @@ function get_changelog_from_svn($branch_url, $log_pattern=null, &$revision=null,
list($tags_url,$branch) = preg_split('#/(branches/|trunk)#',$branch_url); list($tags_url,$branch) = preg_split('#/(branches/|trunk)#',$branch_url);
if (empty($branch)) $branch = $config['version']; if (empty($branch)) $branch = $config['version'];
$tags_url .= '/tags'; $tags_url .= '/tags';
$pattern='/tags\/('.preg_quote($config['version'], '/').'\.[0-9.]+)/'; $pattern='|/tags/('.preg_quote($config['version'], '|').'\.[0-9.]+)|';
$matches = null; $matches = null;
$revision = get_last_svn_tag($tags_url,$pattern,$matches); $revision = get_last_svn_tag($tags_url,$pattern,$matches);
$tag = $matches[1]; $tag = $matches[1];
@ -656,7 +655,7 @@ function get_last_svn_tag($tags_url,$pattern,&$matches=null)
{ {
global $verbose,$svn; global $verbose,$svn;
$cmd = $svn.' log --xml --limit 40 '.escapeshellarg($tags_url); $cmd = $svn.' log --xml --limit 40 -v '.escapeshellarg($tags_url);
if (($v = $verbose)) if (($v = $verbose))
{ {
echo "Querying SVN for last tags\n$cmd\n"; echo "Querying SVN for last tags\n$cmd\n";
@ -671,8 +670,8 @@ function get_last_svn_tag($tags_url,$pattern,&$matches=null)
foreach($xml as $log) foreach($xml as $log)
{ {
//print_r($log); //print_r($log);
if ($pattern[0] != '/' && strpos($log->msg,$pattern) !== false || if ($pattern[0] != '/' && strpos($log->paths->path, $pattern) !== false ||
$pattern[0] == '/' && preg_match($pattern,$log->msg,$matches)) $pattern[0] == '/' && preg_match($pattern, $log->paths->path, $matches))
{ {
if ($verbose) echo "Revision {$log['revision']} matches".($matches?': '.$matches[1] : '')."\n"; if ($verbose) echo "Revision {$log['revision']} matches".($matches?': '.$matches[1] : '')."\n";
return (int)$log['revision']; return (int)$log['revision'];