#!/usr/local/bin/perl -w # ### scan_log # # This script was constructed by James Gilbert in about # 2.1 ms....excellent. # # This script parses the output of "cvs log", outputting # only those records that contain descriptions of changes. # It can be used to show all the changes since a certain # date. # # use strict; use Carp; my $date_format = "" ; $_ = @ARGV; if ($_ == 0 || $_ > 2) { die "Usage: filtercvslogs 'since_date'\n or filtercvslogs 'from_date' 'to_date'\n where date is 'mm/dd/yyyy' note the american date order.\n"; } elsif ($_ == 1) { # single date, use the "all entries since date" format for cvs log command. $date_format = '>='. $ARGV[0] ; } elsif ($_ == 2) { # two dates, use the "all entries between these two dates" format for cvs log command. # note that this is quite right, I don't get output for the second date included. # the below attempt doesn't do it either....sigh # $date_format = $ARGV[0] . '<='. $ARGV[1] . ';' . $ARGV[1] . '>='. $ARGV[0] ; $date_format = $ARGV[0] . '<='. $ARGV[1] ; print "\nWARNING, changes actually on your second date ($ARGV[1]) will NOT be included\n" ; } # temp. as I adjust the script. my $date = $date_format ; # go to the directory specified by the user as their acedb source code directory. my $sourcedir = $ENV{"ACEDB_SRC"} ; chdir($sourcedir) || die "cannot cd to your acedb source code directory ($sourcedir), reason was $!" ; my $sep = '=' x 77; my $int_sep = '-' x 28; $/ = $sep; $| = 1; # cvs log options: # -N says don't show tag information. # -d 'date' says show everything as specified by this date format. # ./w* says do all the acedb directories, e.g. w1 etc. # #my $scan_pipe = "cvs log -N -d '>$date' ./w* 2>/dev/null |"; my $scan_pipe = "cvs log -N -d '$date' ./w* 2>/dev/null |"; open SCAN, $scan_pipe or die "Can't open pipe '$scan_pipe' : $!"; while () { my ($rev) = /selected revisions: (\d+)/; #die "Unexpected chunk:\n$_" unless defined $rev; if ($rev) { my ($rcs_line) = /^(RCS.+)/m; my ($rev_msg) = /($int_sep.+)/os; print "\n$rcs_line\n$rev_msg\n"; } } # this program has stopped working at this bit, don't know why... #close SCAN or die "Error running '$scan_pipe' : $?"; __END__ =pod =head1 NAME filtercvslog - filter out only those files from a cvs log that have been changed. =head1 SYNOPSIS B E E =head1 DESCRIPTION The cvs log command produces output like this: RCS file: /nfs/disk100/acedb/CVS_ACEDB/acedb/w1/acein.c,v Working file: ./w1/acein.c head: 1.35 branch: locks: strict access list: keyword substitution: kv total revisions: 35; selected revisions: 0 description: ============================================================================= RCS file: /nfs/disk100/acedb/CVS_ACEDB/acedb/w1/aceout.c,v Working file: ./w1/aceout.c head: 1.16 branch: locks: strict access list: keyword substitution: kv total revisions: 16; selected revisions: 0 description: ============================================================================= RCS file: /nfs/disk100/acedb/CVS_ACEDB/acedb/w1/freesubs.c,v Working file: ./w1/freesubs.c head: 1.53 branch: locks: strict access list: keyword substitution: kv total revisions: 53; selected revisions: 1 description: ---------------------------- revision 1.53 date: 2000/06/15 22:09:11; author: rdurbin; state: Exp; lines: +50 -27 freeXMLprotect() - probably bugged I am afraid - have to catch a plane! ============================================================================= The entries for acein.c and aceout.c are uninteresting because nothing has been changed in them, we just want the freesubs.c entry. This script parses the above output and will just produce the bits we are interested in: RCS file: /nfs/disk100/acedb/CVS_ACEDB/acedb/w1/freesubs.c,v ---------------------------- revision 1.53 date: 2000/06/15 22:09:11; author: rdurbin; state: Exp; lines: +50 -27 freeXMLprotect() - probably bugged I am afraid - have to catch a plane! ============================================================================= =head1 AUTHOR James Gilbert B jgrg@sanger.ac.uk Thanks to James for writing the original script in about 10 milliseconds which I have then doctored. Ed Griffiths B edgrif@sanger.ac.uk =head1 HISTORY Version 0 =cut