5 # usage scancvslog.pl logfile starttime tag
7 # this will extract all entries from the specified cvs log file
8 # that have a date later than or equal to starttime and a tag
9 # value of tag. If starttime is not specified, all entries are
10 # extracted. If tag is not specified then entries for all
11 # branches are extracted. starttime must be specified as
12 # "monthname day, year"
14 # Example to extract all entries for SAMBA_2_2 branch from the
15 # log file named cvs.log
17 # scancvslog.pl cvs.log "" SAMBA_2_2
20 # To extract all log entries after Jan 10, 1999 (Note month name
21 # must be spelled out completely).
23 # scancvslog.pl cvs.log "January 10, 1999"
26 open(INFILE
,@ARGV[0]) || die "Unable to open @ARGV[0]\n";
55 $Starttime = (@ARGV[1]) ?
&make_time
(@ARGV[1]) : 0;
60 # get rid of extra white space
62 # get rid of any time string in date
64 s/^Date:\s*\w*\s*(\w*)\s*(\w*),\s*(\w*).*/$1 $2 $3/;
65 $Testtime = &make_time
($_);
67 if (($Testtime >= $Starttime) && ($Tagvalue eq $Testtag)) {
68 print join("\n",@Entry),"\n";
76 ($month, $day, $year) = split(" ",$_);
77 if (($year < 1900)||($day < 1)||($day > 31)||not length($Monthnum{$month})) {
78 print "Bad date format @_[0]\n";
79 print "Date needs to be specified as \"Monthname day, year\"\n";
80 print "eg: \"January 10, 1999\"\n";
83 $year = ($year == 19100) ?
2000 : $year;
84 $month = $Monthnum{$month};
85 $Mytime=&timelocal
((0,0,0,$day,$month,$year));
89 @Mytag = grep (/Tag:/,@Entry);
91 s/^.*Tag:\s*(\w*).*/$1/;
97 if (not eof(INFILE
)) {
98 while (not eof(INFILE
)) {
102 if (/^\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/) {
103 next if ($#Entry == -1);