]>
git.wh0rd.org - home.git/blob - r
83816bd0bc68f54c698d89e1d77d0162f39a5397
3 err
() { printf '%b\n' "$*" 1>&2; exit 1; }
4 vr
() { echo "$@"; "$@"; }
22 exec {ctlfd
}<>"${pipe}"
25 jobs_max
=${1:-$(getconf _NPROCESSORS_ONLN)}
27 _mj_child
() { echo ${BASHPID} $? >&${ctlfd} ; }
37 if [[ ${jobs} -eq ${jobs_max} ]] ; then
38 read -r -u ${ctlfd} pid ret
48 while [[ ! -d ${root}/.repo
&& ${root:-/} != "/" ]] ; do
56 for r
in ${*//,/ } ; do
61 ($2 == "chromium.org" || $2 == "google.com") {list = list "," $1}
62 END {print substr(list, 2)}
65 if [[ -z ${owners} ]] ; then
66 err
"cannot find OWNERS list"
68 echo "Auto setting reviewers to: ${owners}"
77 reviewers
=$
(printf '%s,' "${arr[@]}")
78 reviewers
=${reviewers%,}
82 # Diff projects have diff versions of repo. Find a compatible one.
83 local root
=$
(repo_root
)
85 # Use the manifest repo URL.
86 local manifest_dir
="${root}/.repo/manifests.git"
89 # Default to the local repo if it's there.
94 case $
(g
--git-dir="${manifest_dir}" config remote.origin.url
) in
104 ~
/chromiumos
/depot_tools
105 /usr
/local
/src
/depot_tools
110 for d
in "${search[@]}" ; do
111 if [[ -x ${d}/repo
]] ; then
117 # Fallback: use $PATH.
121 case ${acmd:-${cmd}} in
123 if [[ $1 == "all" ]] ; then
125 if [[ $# -eq 0 ]] ; then
126 eval "$(bash-colors --env | sed 's:^:export :')"
129 while read -a line
; do
132 if ! cd "${root}/${dir}" ; then
137 out
=$
(r rb-all .
2>&1)
138 if [[ -n ${out} ]] ; then
139 head=$
(printf "%-40s" "${proj}")
140 echo "${out}" |
sed "s:^:${head} :"
148 #exec r forall -p -c 'r rb all .' </dev/null
156 cd "${root}" ||
exit 1
158 while read -a line
; do
163 out
=$
(g clean
"$@" 2>&1)
164 if [[ -n ${out} ]] ; then
180 f|fetch
) sb_cmd
="fetch" ;;
181 *) err
"unknown sandbox command: $1"
187 cd "${root}" ||
exit 1
189 if [[ ! -e .repo
/sandbox-url
]] ; then
190 err
"Please configure remote url base in ${root}/.repo/sandbox-url"
192 remote
=$
(<.repo
/sandbox-url
) ||
exit 1
194 echo "pushing projects from ${root}"
196 # ssh servers do not like it when you hammer them :)
197 # Received disconnect from 74.125.248.80: 7: Too many concurrent connections
198 # fatal: The remote end hung up unexpectedly
202 tcnt
=$
(echo "${rlist}" |
wc -l)
207 export GIT_DIR
=${path}/.git
209 printf '### (%*i/%i %3i%%) %s\n' \
210 ${#tcnt} $((cnt++)) ${tcnt} $(( cnt * 100 / tcnt )) ${proj}
214 g l
-1 ${src} >& /dev
/null || src
=
215 mj_child g push
--force ${remote}/${proj} ${src}:refs/sandbox/${USER}/${sync_branch} >/dev
/null
220 mj_child g fetch
${remote}/${proj} refs/sandbox/${USER}/${sync_branch}:refs/remotes/sb/${sync_branch} >/dev
/null
223 done < <(echo "${rlist}")
230 while [[ $# -gt 0 ]] ; do
233 process_reviewers
"$2"
234 args
+=( --re "${reviewers}" )
245 email
=${1:-${USER}@chromium.org}
248 git
--git-dir="${root}/.repo/manifests.git" cfg user.email
"${email}"
249 git
--git-dir="${root}/.repo/repo/.git" cfg user.email
"${email}"
252 set -- -c "git cfg user.email '${email}'"
256 exec $
(find_repo
) ${acmd:-${cmd}} "$@"