[CentOS-devel] [PATCH] Updated -r to be more targeted

Thu Jun 19 16:16:38 UTC 2014
Pat Riehecky <riehecky at fnal.gov>

From: Pat Riehecky <riehecky at fnal.gov>

---
 show_possible_srpms.sh |   40 +++++++++++++++++-----------------------
 1 files changed, 17 insertions(+), 23 deletions(-)

diff --git a/show_possible_srpms.sh b/show_possible_srpms.sh
index 3092172..089412c 100755
--- a/show_possible_srpms.sh
+++ b/show_possible_srpms.sh
@@ -12,7 +12,7 @@ usage() {
     echo 'You need to run this from inside a sources git repo' >&2
     echo ''                                               >&2
     echo ' -h: This help message'                         >&2
-    echo ' -r: Use the Redhat tag rather than centos tag' >&2
+    echo ' -r: Use the Redhat commits only'               >&2
     echo ' -c: Return in sha:srpm format'                 >&2
     echo ' -q: Suppress warnings'                         >&2
     echo ''                                               >&2
@@ -23,6 +23,7 @@ usage() {
     echo "  $0 -b c7"                                     >&2
     echo "  $0 -r -b c7"                                  >&2
     echo "  $0 -c -b remotes/origin/c7"                   >&2
+    echo "  $0 -c -r -b remotes/origin/c7"                >&2
     exit 1
 }
 
@@ -33,19 +34,10 @@ warn () {
 }
 
 #####################################################################
-filter () {
-    # filter used for log messages
-    if [[ ${RHELTAG} -eq 1 ]]
-    then
-        grep -v centos | grep import
-    else
-        grep import
-    fi
-}
 
-#####################################################################
+RHELAUTHOR="CentOS Buildsys <bugs at centos.org>"
 
-RHELTAG=0
+RHELONLY=0
 QUIET=0
 WITHCOMMITHASH=0
 BRANCH=""
@@ -66,8 +58,8 @@ while [[ 0 -eq 0 ]]; do
             break
            ;;
          -r )
-            # skip any package with 'centos' in the dist area
-            RHELTAG=1
+            # Only look at commits by RHEL
+            RHELONLY=1
             shift
            ;;
          -c )
@@ -102,16 +94,18 @@ fi
 IFS='
 '
 
+LOGARGS="--pretty=%H|\%s"
+if [[ ${RHELONLY} -eq 1 ]]; then
+    LOGARGS="${LOGARGS} --author='${RHELAUTHOR}'"
+fi
+
 if [[ "x${BRANCH}" != 'x' ]]; then
-    loglist=$(git log ${BRANCH} --pretty="%H|%s" | filter)
-    if [[ $? -ne 0 ]]; then
-        exit 1
-    fi
-else
-    loglist=$(git log --pretty="%H|%s" | filter)
-    if [[ $? -ne 0 ]]; then
-        exit 1
-    fi
+    LOGARGS="${LOGARGS} ${BRANCH}"
+fi
+
+loglist=$(git log ${LOGARGS} |grep import)
+if [[ $? -ne 0 ]]; then
+    exit 1
 fi
 
 # flag for if nothing is found
-- 
1.7.1