mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 08:23:12 +01:00
enhance svn-helper to "understand" ./svn-helper up means update everything, it is a more efficient then svn up . *
This commit is contained in:
parent
a01efd81c8
commit
0d4b66fb79
@ -6,7 +6,7 @@
|
|||||||
* @link http://www.egroupware.org
|
* @link http://www.egroupware.org
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||||
* @copyright (c) 2007-12 by Ralf Becker <rb@stylite.de>
|
* @copyright (c) 2007-13 by Ralf Becker <rb@stylite.de>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -35,23 +35,45 @@ switch ($args[0])
|
|||||||
do_merge($args);
|
do_merge($args);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
case 'up':
|
||||||
$d = opendir($dir=dirname(__FILE__));
|
if (count($args) == 1) // run an svn up over all modules
|
||||||
|
|
||||||
while (($file = readdir($d)) !== false)
|
|
||||||
{
|
{
|
||||||
$path = $dir . '/'. $file;
|
$cmd = 'svn up '.implode(' ', get_app_dirs());
|
||||||
if (!is_dir($path) || in_array($file,array('debian','home','doc','..','.svn'))) continue;
|
echo $cmd."\n";
|
||||||
|
system($cmd);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// fall through
|
||||||
|
default:
|
||||||
|
foreach(get_app_dirs as $module => $dir)
|
||||||
|
{
|
||||||
|
chdir(__DIR__ . '/'. $dir);
|
||||||
|
|
||||||
chdir($path);
|
$args_m = str_replace('$module', $module, implode(' ',$args));
|
||||||
|
echo "$module: svn $args_m\n";
|
||||||
$args_m = str_replace('$module',$file == '.' ? 'egroupware' : $file,implode(' ',$args));
|
|
||||||
echo "$file: svn $args_m\n";
|
|
||||||
system('svn '.$args_m);
|
system('svn '.$args_m);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all EGroupware application directories including "."
|
||||||
|
*
|
||||||
|
* @return array module => relativ path pairs, "egroupware" => ".", "addressbook" => "addressbook", ...
|
||||||
|
*/
|
||||||
|
function get_app_dirs()
|
||||||
|
{
|
||||||
|
$app_dirs = array();
|
||||||
|
foreach(scandir(__DIR__) as $dir)
|
||||||
|
{
|
||||||
|
$path = __DIR__ . '/'. $dir;
|
||||||
|
if (!is_dir($path) || in_array($dir, array('debian','home','doc','..','.svn')) || !is_dir($path.'/setup')) continue;
|
||||||
|
$app_dirs[$dir == '.' ? 'egroupware' : $dir] = $dir;
|
||||||
|
}
|
||||||
|
//error_log(__METHOD__."() returning ".print_r($app_dirs, true));
|
||||||
|
return $app_dirs;
|
||||||
|
}
|
||||||
|
|
||||||
function do_merge(array $args)
|
function do_merge(array $args)
|
||||||
{
|
{
|
||||||
chdir(dirname(__FILE__)); // go to EGroupware root
|
chdir(dirname(__FILE__)); // go to EGroupware root
|
||||||
@ -64,19 +86,24 @@ function do_merge(array $args)
|
|||||||
// get xml log
|
// get xml log
|
||||||
$cmd = "svn log --verbose --xml ".implode(' ',$args);
|
$cmd = "svn log --verbose --xml ".implode(' ',$args);
|
||||||
//echo $cmd;
|
//echo $cmd;
|
||||||
exec($cmd, $output, $err);
|
$output_arr = $err = null;
|
||||||
$output = implode("\n",$output);
|
exec($cmd, $output_arr, $err);
|
||||||
|
$output = implode("\n", $output_arr);
|
||||||
if ($err) throw new Exception("'$cmd' returned $err\n$output");
|
if ($err) throw new Exception("'$cmd' returned $err\n$output");
|
||||||
$log = new SimpleXMLElement($output);
|
$log = new SimpleXMLElement($output);
|
||||||
$modules = $messages = array();
|
$modules = $messages = array();
|
||||||
foreach($log->logentry as $logentry)
|
foreach($log->logentry as $logentry)
|
||||||
{
|
{
|
||||||
foreach($logentry->attributes() as $name => $rev) if ($name == 'revision') break;
|
foreach($logentry->attributes() as $name => $rev)
|
||||||
|
{
|
||||||
|
if ($name == 'revision') break;
|
||||||
|
}
|
||||||
echo "r$rev: ".$logentry->msg."\n";
|
echo "r$rev: ".$logentry->msg."\n";
|
||||||
$messages['r'.$rev] = (string)$logentry->msg;
|
$messages['r'.$rev] = (string)$logentry->msg;
|
||||||
foreach($logentry->paths->path as $path)
|
foreach($logentry->paths->path as $path)
|
||||||
{
|
{
|
||||||
//echo "\t".$path."\n";
|
//echo "\t".$path."\n";
|
||||||
|
$matches = null;
|
||||||
if (preg_match('#(/trunk/|/branches/[^/]+/)([^/]+)/#',$path,$matches))
|
if (preg_match('#(/trunk/|/branches/[^/]+/)([^/]+)/#',$path,$matches))
|
||||||
{
|
{
|
||||||
if (!in_array($matches[2],$modules)) $modules[] = $matches[2];
|
if (!in_array($matches[2],$modules)) $modules[] = $matches[2];
|
||||||
|
Loading…
Reference in New Issue
Block a user