cvsrecent.bsh
This is a bash shell script to get a list of CVS revisions and log messages for all checkins within the past (some number) of days.
I'm using this to help me when writing weekly status reports, so I can make sure I don't forget anything.
It searches recursively, starting from the current directory, for all files that contain a '.' in their names (I only care about *.jsp, *.java, *.xml, etc. at this point), and whose paths do not include '/CVS/' or '/build/'. For each filename it finds, it checks the number of lines that cvs log returns for that file, based on the number of days back that you tell it to look, and if that number is greaterthan the number of lines returned for an unmodified file, the relevant cvs log info is displayed.
Usage: cvsrecent.bsh [DaysAgo]
[DaysAgo] is the number of days past that you want to get cvs log info for. I usually run it with '7' to get the past week's worth of cvs log messages.
NOTE: You will want to have your system configured to not require a password everytime you run the 'cvs' command, or you will get prompted for the password WAAAAY too many times. I do this using ssh-agent.
#!/bin/bash
## cvsrecent.bsh
##
## Author:
## Dave Nelson
## spugbrap.com+blog@gmail.com
##
## Source:
## spugbrap's random geek notes blog
## http://spugbrap.blogspot.com
##
## Debug version available from:
## http://www.oatmealcookies.org/blogdl/cvsrecent-debug.bsh
##
## Date Posted:
## 07/08/2005
# No [DaysAgo] parameter specified
if [ -z "$1" ]
then
echo "Usage: `basename $0` [DaysAgo]"
exit -1
fi
DaysAgo=$1
RefDate=$(date --date="$DaysAgo days ago" +"%Y-%m-%d")
TempFile=/tmp/cvsrecent.$PPID
JunkLogLines=11
fileList=`find . -mtime -$DaysAgo -type f -name '*.*' | grep -v '/CVS/' | grep -v '/build/'`
for curFile in $fileList
do
cvs -Q log -SNd ">=$RefDate" $curFile >$TempFile
totalLogLines=`cat $TempFile | wc -l`
if [ $totalLogLines -gt $JunkLogLines ]
then
echo $curFile
tail -`expr $totalLogLines '-' $JunkLogLines '+' 1` $TempFile
fi
done

0 comments:
Post a Comment