3 err
() { printf '%b\n' "$*" 1>&2; exit 1; }
14 acmd
=$
(git config
--get "alias.${cmd}")
18 case ${acmd:-${cmd}} in
20 if [[ $1 == "all" ]] ; then
22 if [[ $# -eq 0 ]] ; then
23 exec r forall
-c 'r rb all .'
26 branches
=$
(g b |
awk '
28 if ($0 ~ "^[*] *[(]no branch[)]") {
30 } else if ($1 == "*") {
36 END { print list b }')
37 [[ -z ${branches} ]] && exit 0
39 eval $
(bash-colors
--env)
40 echo "${GOOD}### ${PWD}${NORMAL}"
41 for b
in ${branches} ; do
42 echo " ${HILITE}### $b${NORMAL}"
55 while [[ ! -d ${root}/.repo
&& ${root} != "/" ]] ; do
58 cd "${root}" ||
exit 1
60 if [[ ! -e .repo
/sandbox-url
]] ; then
61 err
"Please configure remote url base in ${root}/.repo/sandbox-url"
63 remote
=$
(<.repo
/sandbox-url
) ||
exit 1
65 echo "pushing projects from ${root}"
69 tcnt
=$
(echo "${rlist}" |
wc -l)
74 export GIT_DIR
=${path}/.git
76 printf '### (%*i/%i %3i%%) %s\n' \
77 ${#tcnt} $((cnt++)) ${tcnt} $(( cnt * 100 / tcnt )) ${proj}
79 g l
-1 ${src} >& /dev
/null || src
=
80 ( g push
--force ${remote}/${proj} ${src}:refs/sandbox/${USER}/${sync_branch} >/dev
/null
) &
82 # ssh servers do not like it when you hammer them :)
83 # Received disconnect from 74.125.248.80: 7: Too many concurrent connections
84 # fatal: The remote end hung up unexpectedly
86 if [[ ${#pids[@]} -eq 20 ]] ; then
96 # For the times when repo is being stupid, push directly to gerrit myself.
98 if [[ $# -ne 1 ]] ; then
99 echo "Usage: r g-push <branch>"
102 exec g push cros-internal HEAD
:refs
/for
/master
106 while [[ $# -gt 0 ]] ; do
109 if [[ $2 == *"OWNERS" ]] ; then
110 owners
=$
(awk -F'@' '{list = list "," $1} END {print substr(list, 2)}' "$2")
111 if [[ -z ${owners} ]] ; then
112 err
"cannot find OWNERS list"
114 echo "Auto setting reviewers to: ${owners}"
116 args
+=( --re "${owners}" )
129 exec repo
${acmd:-${cmd}} "$@"