#! /bin/bash # # $Source: /cvs/G/EPICS/App/scripts/showtags,v $ # $Revision: 1.12 $ $Date: 2007/10/30 17:50:43 $ #---------------------------------------------------- # Check the command line # opts=$(getopt -n showtags ahvs $*) if [ $? != 0 ]; then echo Try: -h; exit; fi # # Command line is OK, so set the args and continue. # set -- $opts asciiMonth=0 while [ $# != 0 ]; do case "$1" in -h | -\? | --help) echo "usage: showtags [-a] [-s] [-h] [-v]" echo " Find CVS tags in this directory and subdirectories." echo " If there is a connection to psip0 (Oracle 9) you get date and time info too." echo " Specify -a to get months displayed as abbreviated text string." echo " Specify -s to get the tagged status of files in the directory." exit 0 ;; -v | --version) echo 'Original Author: Dirk Zimoch' echo 'Last Change by $Author: krempaska $' echo '$Revision: 1.12 $ $Date: 2007/10/30 17:50:43 $' echo '$Source: /cvs/G/EPICS/App/scripts/showtags,v $' exit 0 ;; -a) # Display months as abbreviated month strings, not as numbers. asciiMonth=1 ;; -s) # Show the tagged status of the directory. tagStatus exit $? ;; --) ;; *) echo "Invalid argument $1. Try: -h" exit 1 ;; esac shift done trap "stty echo" EXIT SIGTERM SIGKILL TAGS=$(cvs status -v 2>/dev/null | awk ' /\(revision:/ {tag[$1]=1} END {for (i in tag) { print i}} ') function jointags() { echo -n \'$1\' shift while [ $# != 0 ] do echo -n ,\'$1\' shift done echo } TAGLIST=$(jointags $TAGS) function selectNumericMonth () { sqlplus -s gfa_public/pub01@gfaprd <<- EOF SET PAGESIZE 10000; SET LINESIZE 1000; SET SPACE 2; SET FEEDBACK OFF; SELECT TAG_NAME AS "Tag", TAG_DATE AS "Date", TAG_TIME AS "Time" FROM HOSTS.CVS_TAGS_VIEW WHERE TAG_NAME IN ($TAGLIST) ORDER BY TO_DATE(TAG_DATE||' '||TAG_TIME,'DD-MM-YYYY HH24:MI'); EXIT EOF } function selectAsciiMonth () { sqlplus -s gfa_public/pub01@gfaprd <<- EOF SET PAGESIZE 10000; SET LINESIZE 1000; SET SPACE 2; SET FEEDBACK OFF; COLUMN Date FORMAT A11 SELECT TO_CHAR (TO_DATE (TAG_DATE, 'DD-MM-YYYY'),'DD-Mon-YYYY') AS "Date", TAG_TIME AS "Time", TAG_NAME AS "Tag" FROM HOSTS.CVS_TAGS_VIEW WHERE TAG_NAME IN ($TAGLIST) ORDER BY TO_DATE(TAG_DATE||' '||TAG_TIME,'DD-MM-YYYY HH24:MI'); EXIT EOF } if [ $asciiMonth = 0 ]; then DATABASEINFO=$(selectNumericMonth) else DATABASEINFO=$(selectAsciiMonth) fi echo "$DATABASEINFO" for TAG in $TAGS do echo "$DATABASEINFO" | grep -q $TAG || echo $TAG done