3 err() { printf '%b\n' "$*" 1>&2; exit 1; }
18 acmd=$(git config --get "alias.${cmd}")
22 case ${acmd:-${cmd}} in
24 if [[ $1 == "all" ]] ; then
26 if [[ $# -eq 0 ]] ; then
27 exec r forall -p -c 'r rb all .' </dev/null
30 branches=$(g b | awk '
32 if ($0 ~ "^[*] *[(]no branch[)]") {
34 } else if ($1 == "*") {
40 END { print list b }')
41 [[ -z ${branches} ]] && exit 0
43 eval $(bash-colors --env)
44 #echo "${GOOD}### ${PWD}${NORMAL}"
45 for b in ${branches} ; do
46 echo " ${HILITE}### $b${NORMAL}"
59 while [[ ! -d ${root}/.repo && ${root} != "/" ]] ; do
62 cd "${root}" || exit 1
64 if [[ ! -e .repo/sandbox-url ]] ; then
65 err "Please configure remote url base in ${root}/.repo/sandbox-url"
67 remote=$(<.repo/sandbox-url) || exit 1
69 echo "pushing projects from ${root}"
74 exec {ctlfd}<>"${pipe}"
79 tcnt=$(echo "${rlist}" | wc -l)
84 export GIT_DIR=${path}/.git
86 printf '### (%*i/%i %3i%%) %s\n' \
87 ${#tcnt} $((cnt++)) ${tcnt} $(( cnt * 100 / tcnt )) ${proj}
89 g l -1 ${src} >& /dev/null || src=
91 g push --force ${remote}/${proj} ${src}:refs/sandbox/${USER}/${sync_branch} >/dev/null
92 echo ${BASHPID} $? >&${ctlfd}
95 # ssh servers do not like it when you hammer them :)
96 # Received disconnect from 74.125.248.80: 7: Too many concurrent connections
97 # fatal: The remote end hung up unexpectedly
99 if [[ ${jobs} -eq 16 ]] ; then
100 read -r -u ${ctlfd} pid ret
109 # For the times when repo is being stupid, push directly to gerrit myself.
110 exec git push origin HEAD:refs/for/master
113 [[ $# -eq 0 ]] && set -- -j16
117 while [[ $# -gt 0 ]] ; do
120 if [[ $2 == *"OWNERS" ]] ; then
121 owners=$(awk -F'@' '{list = list "," $1} END {print substr(list, 2)}' "$2")
122 if [[ -z ${owners} ]] ; then
123 err "cannot find OWNERS list"
125 echo "Auto setting reviewers to: ${owners}"
127 args+=( --re "${owners}" )
140 exec repo ${acmd:-${cmd}} "$@"