From 8f20a215c0485e06312abb7847c772a93706849a Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 11 Apr 2012 12:01:15 -0400 Subject: [PATCH] add repo OWNERS integration --- .bin/r | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/.bin/r b/.bin/r index 518b266..8e240dc 100755 --- a/.bin/r +++ b/.bin/r @@ -1,5 +1,6 @@ #!/bin/bash g() { git "$@"; } +err() { printf '%b\n' "$*" 1>&2; exit 1; } case $1 in ""|-*) ;; @@ -53,8 +54,7 @@ sb-push) 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 @@ -88,6 +88,29 @@ sb-push) 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}} "$@" -- 2.39.5