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";
43 $Starttime = (@ARGV[1]) ? &make_time(@ARGV[1]) : 0;
48 s/^Date:\s*\w*\s*(\w*)\s*(\w*),\s*(\w*).*/$1 $2 $3/;
49 $Testtime = &make_time($_);
51 if (($Testtime >= $Starttime) && ($Tagvalue eq $Testtag)) {
52 print join("\n",@Entry),"\n";
60 ($month, $day, $year) = split(" ",$_);
61 if (($year < 1900)||($day < 1)||($day > 31)||not length($Monthnum{$month})) {
62 print "Bad date format @_[0]\n";
63 print "Date needs to be specified as \"Monthname day, year\"\n";
64 print "eg: \"January 10, 1999\"\n";
67 $year = ($year == 19100) ? 2000 : $year;
68 $month = $Monthnum{$month};
69 $Mytime=&timelocal((0,0,0,$day,$month,$year));
73 @Mytag = grep (/Tag:/,@Entry);
75 s/^.*Tag:\s*(\w*).*/$1/;
81 if (not eof(INFILE)) {
82 while (not eof(INFILE)) {
86 if (/^\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/) {
87 next if ($#Entry == -1);