Page MenuHomePhabricator

update-all-repos.sh

Authored By
hach-que
May 7 2015, 12:48 AM
Size
1 KB
Referenced Files
None
Subscribers
None

update-all-repos.sh

#!/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 ..
}

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/uv/ex/xjh3hwiinlvv7pc4
Default Alt Text
update-all-repos.sh (1 KB)

Event Timeline