#!/bin/sh # # $Id$ # # Example routines to parse tag information from 'cvs status -v' # command. parse_tags () { FILENAME=$1 TAGS=`cvs status -v "$FILENAME" | \ awk 'BEGIN { RS="\n\n"; FS="[ \t\n][ \t\n]+" } \ /Existing Tags:/{ if( $3 !~ /No Tags Exist/ ) print $0 }'` echo $TAGS } file_is_tagged () { TAGS=`parse_tags "$1"` if [ -z "$TAGS" ]; then return 1 else return 0 fi } report_cvs_tags () { TAGS=`parse_tags "$1"` if [ ! -z "$TAGS" ]; then echo "warning: file $1: $TAGS" fi } report_cvs_tags "$1" # example how to fail the commit if tag found #if file_is_tagged "$1"; then # echo "tagged: $1" # exit 1 #fi