err() { printf '%b\n' "$*" 1>&2; exit 1; }
vr() { echo "$@"; "$@"; }
+case $1 in
+-x) set -x; shift;;
+esac
+
case $1 in
""|-*) ;;
l)
for r in ${*//,/ } ; do
case ${r} in
*OWNERS)
- local owners=$(awk -F'@' '{list = list "," $1} END {print substr(list, 2)}' "${r}")
+ local owners=$(
+ awk -F'@' '
+ ($2 == "chromium.org" || $2 == "google.com") {list = list "," $1}
+ END {print substr(list, 2)}
+ ' "${r}"
+ )
if [[ -z ${owners} ]] ; then
err "cannot find OWNERS list"
else
while read -a line ; do
dir=${line[0]}
proj=${line[2]}
- cd "${root}/${dir}"
+ if ! cd "${root}/${dir}" ; then
+ echo "bad ${proj}"
+ continue
+ fi
(
out=$(env _proj=${proj} r rb all . 2>&1)
if [[ -n ${out} ]] ; then
printf '%s### %s%-40s%s: %s\n' \
"${BRACKET}" "${GOOD}" "${line%%:*}" "${NORMAL}" "${line#*:}"
else
- echo "${line}"
+ printf '%s### %s%-40s%s: ERROR: %s\n' \
+ "${BRACKET}" "${BAD}" "${dir}" "${NORMAL}" "${line}"
fi
done < <(echo "${out}")
fi
{
if ($0 ~ "^[*] *[(]no branch[)]") {
next
- } else if ($0 ~ "^[*] *[(]detached from ") {
+ } else if ($0 ~ "^[*] *[(](HEAD )?detached (from|at) ") {
next
} else if ($1 == "*") {
b = $2
;;
esac
-exec repo ${acmd:-${cmd}} "$@"
+exec python2 $(type -P repo) ${acmd:-${cmd}} "$@"