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 -p -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}"
70 exec {ctlfd}<>"${pipe}"
75 tcnt=$(echo "${rlist}" | wc -l)
80 export GIT_DIR=${path}/.git
82 printf '### (%*i/%i %3i%%) %s\n' \
83 ${#tcnt} $((cnt++)) ${tcnt} $(( cnt * 100 / tcnt )) ${proj}
85 g l -1 ${src} >& /dev/null || src=
87 g push --force ${remote}/${proj} ${src}:refs/sandbox/${USER}/${sync_branch} >/dev/null
88 echo ${BASHPID} $? >&${ctlfd}
91 # ssh servers do not like it when you hammer them :)
92 # Received disconnect from 74.125.248.80: 7: Too many concurrent connections
93 # fatal: The remote end hung up unexpectedly
95 if [[ ${jobs} -eq 16 ]] ; then
96 read -r -u ${ctlfd} pid ret
105 # For the times when repo is being stupid, push directly to gerrit myself.
107 if [[ $# -ne 1 ]] ; then
108 echo "Usage: r g-push <branch>"
111 exec g push cros-internal HEAD:refs/for/master
115 while [[ $# -gt 0 ]] ; do
118 if [[ $2 == *"OWNERS" ]] ; then
119 owners=$(awk -F'@' '{list = list "," $1} END {print substr(list, 2)}' "$2")
120 if [[ -z ${owners} ]] ; then
121 err "cannot find OWNERS list"
123 echo "Auto setting reviewers to: ${owners}"
125 args+=( --re "${owners}" )
138 exec repo ${acmd:-${cmd}} "$@"