Created
June 26, 2012 14:19
-
-
Save radmiraal/2996041 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ini_set('display_errors', 1); | |
error_reporting(E_ALL ^ E_STRICT); | |
$project = getenv('GERRIT_PROJECT'); | |
$path = dirname(__DIR__ . '../'); | |
$submodules = shell_exec(sprintf("cd %s && git submodule foreach --recursive 'git config remote.origin.url | grep \"%s.git\" || :'", $path, $project)); | |
$submodules = explode(chr(10), $submodules); | |
foreach ($submodules as $index => $submodule) { | |
if (substr($submodule, 0, 9) !== 'Entering ') { | |
$path = realpath(__DIR__ . '/../' . str_replace(array('Entering ', "'"), '', $submodules[$index - 1])); | |
} | |
} | |
$cherryPickCommand = sprintf('git fetch ssh://%s/%s %s && git cherry-pick FETCH_HEAD', getenv('GERRIT_HOST'), $project, getenv('GERRIT_REFSPEC')); | |
echo shell_exec(sprintf('cd %s && %s', $path, $cherryPickCommand)); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment