# cvsl: show/get file's version history or Get file.version # AUTHOR: GPL(C) Mohsin Ahmed, http://www.cs.albany.edu/~mosh DATEFORMAT2='+%y%m%d_%H%M%S' : ${NUL:=nul} : ${TMP:=.} cvsl_usage(){ echo " USAGE: cvsl FILE ... mode 1. Show cvs log of FILE cvsl FILE VERSIONs... mode 2. Get ./FILE-VERSIONs Example: cvsl file.c 1.2 ... Creates file.c-1.2 cvsl file.c 1.2 1.3 ... Creates file.c-1.2 and file.c-1.3 " exit } if [[ "$#" < 1 ]] ; then cvsl_usage fi if [[ -r "$1" ]] ; then FILE=$1 else cvsl_usage fi # mode 1 .. do cvs log .. if [[ "$#" = 1 ]] ; then # cvs status $FILE | egrep -i 'Status|revision:' echo "Collecting cvs log of $FILE" echo "cvs log -l $FILE > $TMP/cvslog.log" cvs log -l $FILE > $TMP/cvslog.log echo "Sorting to $TMP/cvslog.txt" perl ~/perl/cvs-log.pl $TMP/cvslog.log exit fi # mode 2 .. get old files .. shift while [[ $# > 0 ]] do VER=$1 shift echo "Extracting file $FILE to $FILE-$VER" echo "cvs up -p -r $VER $FILE > $FILE-$VER" cvs up -p -r $VER $FILE > $FILE-$VER 2> $NUL ### Next two lines swap file.v and file # mv -vi ${FILE:?} $FILE-`date $DATEFORMAT2` # cp -vip $FILE-$VER $FILE done