#!/bin/bash
g() { git "$@"; }
+err() { printf '%b\n' "$*" 1>&2; exit 1; }
case $1 in
""|-*) ;;
cd "${root}" || exit 1
if [[ ! -e .repo/sandbox-url ]] ; then
- echo "Please configure remote url base in ${root}/.repo/sandbox-url"
- exit 1
+ err "Please configure remote url base in ${root}/.repo/sandbox-url"
fi
remote=$(<.repo/sandbox-url) || exit 1
exit 0
;;
+upload)
+ args=()
+ while [[ $# -gt 0 ]] ; do
+ case $1 in
+ --re)
+ if [[ $2 == "OWNERS" ]] ; then
+ owners=$(awk -F'@' '{list = list "," $1} END {print substr(list, 2)}' OWNERS)
+ if [[ -z ${owners} ]] ; then
+ err "cannot find OWNERS list"
+ else
+ echo "Auto setting reviewers to: ${owners}"
+ fi
+ args+=( --re "${owners}" )
+ shift 2
+ continue
+ fi
+ ;;
+ esac
+ args+=( "$1" )
+ shift
+ done
+ set -- "${args[@]}"
+ ;;
esac
exec repo ${acmd:-${cmd}} "$@"