From dd334a4e7d76498a99cfacfcb1875f207b1aff84 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sat, 27 Jun 2015 16:46:51 +0000 Subject: [PATCH] teach ./svn-helper.php up to cope with apps being git repos --- svn-helper.php | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/svn-helper.php b/svn-helper.php index 91dbd94e01..a69965d303 100755 --- a/svn-helper.php +++ b/svn-helper.php @@ -38,9 +38,16 @@ switch ($args[0]) case 'up': if (count($args) == 1) // run an svn up over all modules { - $cmd = 'svn up '.implode(' ', get_app_dirs()); - echo $cmd."\n"; - system($cmd); + foreach(array( + 'svn' => 'svn_up', + 'git' => 'git_pull', + ) as $type => $cmd) + { + if (($modules = get_app_dirs($type))) + { + $cmd($modules); + } + } break; } // fall through @@ -56,19 +63,37 @@ switch ($args[0]) break; } +function git_pull(array $modules) +{ + foreach($modules as $module) + { + $cmd = "(cd $module; git pull)"; + echo $cmd."\n"; + system($cmd); + } +} + +function svn_up(array $modules) +{ + $cmd = 'svn up '.implode(' ', $modules); + echo $cmd."\n"; + system($cmd); +} + /** * Get all EGroupware application directories including "." * * @return array module => relativ path pairs, "egroupware" => ".", "addressbook" => "addressbook", ... */ -function get_app_dirs() +function get_app_dirs($type='svn') { $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') && $dir != 'setup'|| $dir =='felamimail' || $dir =='messenger') continue; + !is_dir($path.'/setup') && $dir != 'setup') continue; + if (file_exists($path.'/.git') != ($type == 'git')) continue; $app_dirs[$dir == '.' ? 'egroupware' : $dir] = $dir; } //error_log(__METHOD__."() returning ".print_r($app_dirs, true));