Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P1774
update-all-repos.sh
Active
Public
Actions
Authored by
hach-que
on May 7 2015, 12:48 AM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F393992: update-all-repos.sh
May 7 2015, 12:48 AM
2015-05-07 00:48:34 (UTC+0)
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
edited the content of this paste.
(Show Details)
May 7 2015, 12:48 AM
2015-05-07 00:48:34 (UTC+0)
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
.
Log In to Comment