Page MenuHomePhabricator
Paste P1774

update-all-repos.sh
ActivePublic

Authored by hach-que on May 7 2015, 12:48 AM.
Tags
None
Referenced Files
F393992: update-all-repos.sh
May 7 2015, 12:48 AM
Subscribers
None
#!/bin/omni
: $json = $(echo '{}' | arc --conduit-uri=https://secure.phabricator.com/ call-conduit repository.query)
: $repos = <?php return json_decode($shell->getVariable('json'), true); ?>
: $futures = @()
: $shouldClone = () => {
return (<?php
$arr = $shell->getVariable('1')->getCopy();
return !is_dir($arr['callsign']) && idx($arr, 'uri') !== null;
?>);
}
: $directoryExists = () => {
return (<?php
$arr = $shell->getVariable('1')->getCopy();
return is_dir($arr['callsign']);
?>);
}
: $reposCloned = @()
foreach ($repos->response) as $repo {
if ($shouldClone($repo)) {
: $futures->($repo->callsign) = $(new -t ExecFuture "%s clone %s %s" ($repo->vcs) ($repo->uri) ($repo->callsign))
} else {
if ($directoryExists($repo)) {
: $reposCloned->[] = ($repo->callsign);
}
echo ("Not cloning " + $repo->callsign)
}
}
echo "Cloning repositories in parallel..."
foreach $(futures $futures) as $callsign => $future {
: $result = ($future->resolve())
if (<?php return idx($shell->getVariable('result')->getCopy(), '0') == 0; ?>) {
: $reposCloned->[] = $callsign
echo ("" + $callsign + " cloned")
} else {
echo ("" + $callsign + " could not be cloned")
}
}
foreach $reposCloned as $repo {
cd $repo
../modify-commit-and-push.sh &
cd ..
}

Event Timeline

hach-que changed the title of this paste from untitled to update-all-repos.sh.
hach-que updated the paste's language from autodetect to autodetect.