#!/bin/omni : $json = $(echo '{}' | arc --conduit-uri=https://secure.phabricator.com/ call-conduit repository.query) : $repos = getVariable('json'), true); ?> : $futures = @() : $shouldClone = () => { return (getVariable('1')->getCopy(); return !is_dir($arr['callsign']) && idx($arr, 'uri') !== null; ?>); } : $directoryExists = () => { return (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 (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 .. }