]> git.wh0rd.org - home.git/commitdiff
add repo OWNERS integration
authorMike Frysinger <vapier@gentoo.org>
Wed, 11 Apr 2012 16:01:15 +0000 (12:01 -0400)
committerMike Frysinger <vapier@gentoo.org>
Sat, 28 Apr 2012 19:36:47 +0000 (15:36 -0400)
.bin/r

diff --git a/.bin/r b/.bin/r
index 518b266db153d3b831ccfabc0fe2ae415f9ef1f0..8e240dc6981a698ed215472949a32a2c3f3dbcf2 100755 (executable)
--- 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}} "$@"