8bc7a500aab769e21fe3271235ae5056a895e0d0
kuhn
  Fri Aug 12 10:17:20 2011 -0700
added logic to detect rare empty B-queue and quit
diff --git src/utils/qa/alertBqueue.csh src/utils/qa/alertBqueue.csh
index 9ababa6..5493936 100755
--- src/utils/qa/alertBqueue.csh
+++ src/utils/qa/alertBqueue.csh
@@ -44,53 +44,61 @@
 
 # echo "testing \n \n sending only to ann and bob right now \n \n "  > Bfile
 echo "greetings. \n" > Bfile
 echo "  this is a periodic reminder from a QA cronjob." >> Bfile
 echo "  you have content in the B-queue that someone should look at." >> Bfile
 echo "  discarding the track =is= an option." >> Bfile
 echo "\n  usually a track is in the B-queue because QA is expecting something" >> Bfile
 echo "  from the dev crew.\n" >> Bfile
 hgsql -h $sqlbeta -t -e "SELECT dbs, track, reviewer, sponsor, \
   qadate FROM pushQ WHERE priority = 'B' AND reviewer != '' ORDER BY qadate" \
   qapushq >> Bfile
 
 # get list of all developers and QA involved in B-queue tracks
 set contacts=`hgsql -N -h $sqlbeta -e "SELECT sponsor, reviewer FROM pushQ \
   WHERE priority = 'B' AND reviewer != ''" qapushq`
+
+# check for empty Bqueue
+if ( "$contacts" == "" ) then
+  # echo "quitting.  nothing to do"
+  exit
+endif
+
 # clean up list to get unique names
 set contacts=`echo $contacts | sed "s/,/ /g" | sed "s/ /\n/g" \
   | perl -wpe '$_ = lcfirst($_);' | sort -u`
 
 set debug=true
 set debug=false
 if ( $debug == "true" ) then
   echo "\ncontacts $contacts"
     set contacts=`echo $contacts | sed "s/,/ /" | sed "s/ /\n/g" \
     | perl -wpe '$_ = lcfirst($_);' | sort -u`
+  echo "contactsReal $contacts"
   set contacts="larrym kate fan ann Hiram rachel Andy andy bob larry "
-  echo "contacts $contacts"
+  echo "contactsDebug $contacts"
 endif
 
 # replace common names with email addresses
 foreach i ( $counter )
   set contacts=`echo $contacts | sed "s/$alias[$i] /$email[$i] /g"`
   if ( $debug == "true" ) then
     echo    here5 $i
     echo    $alias[$i]
     echo    $email[$i]
     echo "   contacts $contacts"
     ## send output only to selected people
     # set contacts="ann kuhn pauline rhead"
-    # set contacts="pauline rhead ann"
+    set contacts="kuhn"
     echo "   contacts $contacts"
     cat Bfile 
     exit
   endif 
 end
 
 # add ann to list
 set contacts="$contacts ann "
 
 # cat Bfile | mail -c $contacts'@soe.ucsc.edu' -s "test. ignore  " $USER
 cat Bfile | mail -c $contacts'@soe.ucsc.edu' -s "B-queue alert" $USER
 rm Bfile
 
