I use CVS to provide revision management for the web site, but my
memory is so bad, I keep forgetting that I need to cvs add
new files to the repository before doing a cvs commit
.
The cvs status file
command will state if a file is
not in the repository (it has a status of Uknown), but the
output from cvs status
is very verbose. Hence, I wrote a
small script to remind me which files I had yet to add to the
repository, cvschk
.
I now find that writing this script was a waste of time, as its action can be better invoked by:
alias cvsnew "cvs -n -q update | grep '^\?' | sed -e 's/^\?//'"
Sigh. Here it is anyway...
#!/bin/sh # # NAME # cvschk -- Identify unmanaged files in a CVS sandbox # # SYNOPSIS # cvschk [directory] # # DESCRIPTION # cvschk will perform a 'cvs status' on all the directory and files # in the current working directory, if it is identified as a CVS # sandbox (i.e. a CVS file exists at the top level). # # It will display a list of unknown (i.e. unmanaged) files on stdout. # # If the directory argument is provided, that is used instead of the # current working directory. # # MODIFICATION HISTORY # Mnemonic Rel Date Who # cvschk 1.0 060304 mpw dir=$PWD SCRIPT=`basename $0` if [ $# -eq 1 ]; then if [ ! -d $1 ]; then echo "${SCRIPT}: $1 is not a readable directory." exit 2 else dir=$1 cd $dir fi fi if [ ! -r CVS ]; then echo "${SCRIPT}: \"$dir\" does not appear to be a CVS sandbox." exit 2 fi exitstatus=0 filelist=`find . -type d -name CVS -prune -o -type f -print` tmpfile="/tmp/cvs$$" cvs status $filelist >/dev/null 2>$tmpfile if [ -s $tmpfile ]; then echo "The following files are not known by cvs:" awk '/cvs add/ {print "\t",$NF; next} {print "CVS ERROR: " $0}' $tmpfile exitstatus=1 fi rm $tmpfile exit $exitstatus