[CentOS-devel] [PATCH 3/3] Added switches for setting branch to check, alas I've no idea how to do this

Pat Riehecky riehecky at fnal.gov
Fri Jun 13 21:53:41 UTC 2014


From: Pat Riehecky <riehecky at fnal.gov>

---
 show_possible_srpms.sh |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/show_possible_srpms.sh b/show_possible_srpms.sh
index dc31c65..413204c 100755
--- a/show_possible_srpms.sh
+++ b/show_possible_srpms.sh
@@ -7,13 +7,16 @@
 #####################################################################
 usage() {
     echo ''                                               >&2
-    echo "$0 [-hrcq]"                                     >&2
+    echo "$0 [-hrcq] [-b branch]"                         >&2
     echo ''                                               >&2
     echo ' -h: This help message'                         >&2
     echo ' -r: Use the Redhat tag rather than centos tag' >&2
     echo ' -c: Return in sha:srpm format'                 >&2
     echo ' -q: Suppress warnings'                         >&2
     echo ''                                               >&2
+    echo ' -b: specify a branch to examine'               >&2
+    echo "     defaults to repo's current branch"         >&2
+    echo ''                                               >&2
     exit 1
 }
 
@@ -22,7 +25,7 @@ usage() {
 # setup args in the right order for making getopt evaluation
 # nice and easy.  You'll need to read the manpages for more info
 # or review getopt-parse.bash under /usr/share/doc from which much was borrowed
-args=$(getopt -o hrcq -- "$@")
+args=$(getopt -o hrcqb: -- "$@")
 if [[ $? -ne 0 ]]; then
     usage
 fi
@@ -31,6 +34,7 @@ eval set -- "$args"
 RHELTAG=0
 QUIET=0
 WITHCOMMITHASH=0
+BRANCH=""
 for arg in "$@"; do
     case $1 in
         -- )
@@ -50,6 +54,12 @@ for arg in "$@"; do
             # suppress warnings
             QUIET=1
            ;;
+         -b )
+            # Check this particular branch 
+            BRANCH=$2
+            shift
+            shift
+           ;;
          -h )
             # get help
             usage
@@ -81,9 +91,16 @@ filter () {
 IFS='
 '
 
+if [[ "x${BRANCH}" != 'x' ]]; then
+    echo "Someone with git-foo, a little help?"
+    exit 1
+else
+    loglist=$(git log --pretty="%H|%s" | filter)
+fi
+
 # flag for if nothing is found
 FOUND=False
-for entry in $(git log --pretty="%H|%s" | filter); do
+for entry in $loglist; do
     FOUND=True
 
     pkg=$(echo ${entry} | cut -d' ' -f2)
-- 
1.7.1




More information about the CentOS-devel mailing list