# Author: Audris Mockus # (C) Copyright (2000) by Lucent Technologies Inc. All rights reserved. # THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF LUCENT TECHNOLOGIES. # The copyright notice above does not evidence any actual # or intended publication of such source code. # #Extract each revision from cvs log output # require "timelocal.pl"; sub output { if ($reviewed eq ""){$reviewed=0;} if ($submitted eq ""){$submitted=0;} $log=~s/\:\:$//; $rev =~s/\;/SEMICOLON/g; $log =~s/\;/SEMICOLON/g; print "$f\;$mod\;$rev\;$vv\;$y/$m/$d\;$stmp\;$a\;$nadd\;$ndel\;$submitted\;$reviewed\;$log\n"; $log=""; } open (A, "gunzip < $ARGV[0] |"); { $getheader=1;$getnames=0;$doRev=0;$vv="";%vers=""; while(){ chop (); #catch end of last revision information if (/^=============================================================================$/){ #print STDERR "File ended\n"; $getheader=1;$getnames=0;$doRev=0;$vv="";%vers=""; &output (); next; } #catch the end of header and end of revision information if (/^----------------------------$/){ #print STDERR "REVISION ended\n"; if ($getheader){ $getnames=0; $getheader=0; $doRev=1; next; }else{ &output (); next; } } #process file header if($getheader){ if (/Working file: (.+)$/){ $f=$1; next; } if (/^RCS file: (.+)$/){ $mod=$1; $mod=~s/\,v$//; $mod=~s/^\.\///; $mod=~s/\/[^\/]+$//; next; } if (/^keyword substitution:/){ #ignore $getnames=0; next; } if (/^total revisions:/){ #ignore next; } if (/^description:/){ #ignore next; } if ($getnames){ if(/^ [A-z]/){ s/[ \t\n]//g; @x=split(/\:/); $vers{$x[1]}=$x[0]; next; } #print "$x[1]\;$vers{$x[1]}\n"; } if (/^symbolic names:/){ #ignore $getnames=1; next; } } #process revision if($doRev){ if (/^revision (.+)$/){ $rev=$1; undef $submitted;undef $reviewed; undef $y;undef $m;undef $d;undef $stmp;undef $vv; undef $a; undef $nadd;undef $ndel; next; } if (/^date: (\d\d\d\d)\/(\d\d)\/(\d\d) (\d\d)\:(\d\d)\:(\d\d)\;\s+author: (.+)\;\s+state: (.+)\;(.*)$/){ $y=$1; $m=$2; $d=$3; $hr=$4; $minu=$5; $sec=$6; $stmp = &timelocal (($sec,$minu,$hr,$d,$m-1,$y-1900)); $a=$7; $s=$8; $lin=$9; $nadd=0;$ndel=0; if($lin=~/\s+lines: \+(\d+) \-(\d+)$/){ $nadd=$1; $ndel=$2; } if($vers{$rev} ne ""){$vv=$vers{$rev};} next; } if (/Submitted by:\s+(.+)$/){ $submitted=$1; next; } if (/Reviewed by:\s+(.+)$/){ $reviewed=$1; next; } #otherwise just a description $log =~ s/\;/SEMICOLON/g; $log .= "$_"."NEWLINE"; } } }