src/utils/qa/getSplit.csh 1.8

1.8 2009/05/11 03:36:47 kuhn
adjusted so default is to dev and a few other cosmetic changes
Index: src/utils/qa/getSplit.csh
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/utils/qa/getSplit.csh,v
retrieving revision 1.7
retrieving revision 1.8
diff -b -B -U 4 -r1.7 -r1.8
--- src/utils/qa/getSplit.csh	11 Apr 2009 00:37:04 -0000	1.7
+++ src/utils/qa/getSplit.csh	11 May 2009 03:36:47 -0000	1.8
@@ -10,20 +10,20 @@
 #
 #######################
 
 set tablename=""
-set machine="hgwbeta"
-set host="-h $sqlbeta"
+set machine="hgwdev"
+set host=""
 set db=""
 
-if ($#argv < 2 || $#argv > 3) then
+if ( $#argv < 2 || $#argv > 3 ) then
   echo
   echo "  determines if table is in split format "
   echo "    and returns split name if so."
   echo
-  echo "    usage:  db tablename [hgwdev|hgwbeta]"
+  echo "    usage:  db tablename [hgwdev | hgwbeta]"
   echo
-  echo "      third argument accepts machine, defaults to beta"
+  echo "      third argument accepts machine, defaults to hgwdev"
   echo
   exit
 else
   set db=$argv[1]
@@ -35,13 +35,17 @@
  exit 1
 endif
 
 # assign command line arguments
-if ($#argv == 3) then
+if ( $#argv == 3 ) then
+  if ( $argv[3] == "hgwbeta" ) then
   set machine="$argv[3]"
-  set host="-h $argv[3]"
-  if ($argv[3] == "hgwdev") then
-    set host=""
+    set host="-h $sqlbeta"
+  else
+    if ( $argv[3] != "hgwdev" ) then
+      echo "only hgwdev and hgwbeta are allowed in $0."
+      exit 1
+    endif
   endif
 endif
 
 # echo "db = $db"
@@ -63,13 +67,18 @@
 
 set chrom=""
 set split=""
 set isChromInfo=0
-if ( $machine == hgwdev || $machine == hgwbeta ) then
-  # check for chromInfo table
-  set isChromInfo=`hgsql -N $host -e 'SHOW TABLES' $db | grep "chromInfo" \
+
+# check for chromInfo table
+set isChromInfo=`hgsql -N $host -e 'SHOW TABLES' $db | grep "chromInfo" \
      | wc -l`
-  if ( $isChromInfo > 0 ) then
+  if ( $status ) then
+    echo "$0 defaults to hgwbeta.  also check spelling of database"
+    echo
+    exit 1
+  endif
+if ( $isChromInfo > 0 ) then
     set chrom=`hgsql -N $host -e 'SELECT chrom FROM chromInfo LIMIT 1' $db`
 
     # check if split table
     set split=`hgsql -N $host -e 'SHOW TABLES LIKE "'${chrom}_$tablename'"' \
@@ -79,14 +88,10 @@
     else 
       echo "unsplit"
     endif
     exit 0
-  else
+else
     echo "no chromInfo table.  split irrelevant"
     exit 1
-  endif
-else   # not dev or beta
-  echo "\n  only works on dev and beta\n"
-  echo "${0}:"
-  $0
+endif
 echo