]>
git.wh0rd.org - home.git/blob - .bin/r
3 err
() { printf '%b\n' "$*" 1>&2; exit 1; }
10 acmd
=$
(git config
--get "alias.${cmd}")
14 case ${acmd:-${cmd}} in
16 if [[ $1 == "all" ]] ; then
18 if [[ $# -eq 0 ]] ; then
19 exec r forall
-c 'r rb all .'
22 branches
=$
(g b |
awk '
24 if ($0 ~ "^[*] *[(]no branch[)]") {
26 } else if ($1 == "*") {
32 END { print list b }')
33 [[ -z ${branches} ]] && exit 0
35 eval $
(bash-colors
--env)
36 echo "${GOOD}### ${PWD}${NORMAL}"
37 for b
in ${branches} ; do
38 echo " ${HILITE}### $b${NORMAL}"
51 while [[ ! -d ${root}/.repo
&& ${root} != "/" ]] ; do
54 cd "${root}" ||
exit 1
56 if [[ ! -e .repo
/sandbox-url
]] ; then
57 err
"Please configure remote url base in ${root}/.repo/sandbox-url"
59 remote
=$
(<.repo
/sandbox-url
) ||
exit 1
61 echo "pushing projects from ${root}"
65 tcnt
=$
(echo "${rlist}" |
wc -l)
70 export GIT_DIR
=${path}/.git
72 printf '### (%*i/%i %3i%%) %s\n' \
73 ${#tcnt} $((cnt++)) ${tcnt} $(( cnt * 100 / tcnt )) ${proj}
75 g l
-1 ${src} >& /dev
/null || src
=
76 ( g push
--force ${remote}/${proj} ${src}:refs/sandbox/${USER}/${sync_branch} >/dev
/null
) &
78 # ssh servers do not like it when you hammer them :)
79 # Received disconnect from 74.125.248.80: 7: Too many concurrent connections
80 # fatal: The remote end hung up unexpectedly
82 if [[ ${#pids[@]} -eq 20 ]] ; then
93 while [[ $# -gt 0 ]] ; do
96 if [[ $2 == *"OWNERS" ]] ; then
97 owners
=$
(awk -F'@' '{list = list "," $1} END {print substr(list, 2)}' "$2")
98 if [[ -z ${owners} ]] ; then
99 err
"cannot find OWNERS list"
101 echo "Auto setting reviewers to: ${owners}"
103 args
+=( --re "${owners}" )
116 exec repo
${acmd:-${cmd}} "$@"