function run_commands($commands) { global $dry_run; foreach ($commands as $command) { if (!$dry_run) { $exit = silent_system($command); if (0 != $exit) { break; } } else { echo "CMD:\t{$command}\n"; } } }
if ($application_git_checkout != $pot_git_checkout) { chdir($pot_git_checkout); $exit = silent_system("git pull"); if (0 != $exit) { die; } } $exists = is_file($pot); $makepot = new MakePOT(); if (!call_user_func(array(&$makepot, $makepot_project), $application_git_checkout, "{$pot_directory}/{$pot}")) { continue; } if (!file_exists("{$pot_directory}/{$pot}")) { continue; } // do not commit if the difference is only in the header, but always commit a new file $real_differences = `git diff {$pot} | wc -l` > 16; if (!$exists || $real_differences) { foreach (array("git add {$pot}", "git commit {$pot} -m 'Automatic POT update'", "git push origin {$branch}") as $command) { if (!$dry_run) { $exit = silent_system($command); if (0 != $exit) { break; } } else { echo "CMD:\t{$command}\n"; } } } else { silent_system("git checkout {$pot}"); }
if (!is_dir(dirname("{$pot_svn_checkout}/{$pot}"))) { continue; } if (!call_user_func(array(&$makepot, $makepot_project), $application_path, "{$pot_svn_checkout}/{$pot}")) { continue; } if (!file_exists("{$pot_svn_checkout}/{$pot}")) { continue; } if (!$exists) { $exit = silent_system("{$svn} add {$pot}"); if (0 != $exit) { continue; } } // do not commit if the difference is only in the header, but always commit a new file $real_differences = `svn diff {$pot} | wc -l` > 16; $target = $exists ? $pot : $version; if (!$exists || $real_differences) { preg_match('/Revision:\\s+(\\d+)/', `svn info {$application_path}`, $matches); $logmsg = isset($matches[1]) && intval($matches[1]) ? "POT, generated from r" . intval($matches[1]) : 'Automatic POT update'; $command = "{$svn} ci {$target} --non-interactive --message='{$logmsg}'"; if (!$dry_run) { silent_system($command); } else { echo "CMD:\t{$command}\n"; } } else { silent_system("{$svn} revert {$target}"); } }