-ChangeDir( $LLVMSrcDir , "llvm source directory") ;
-
-##############################################################
-#
-# Get some static statistics about the current state of CVS
-#
-# This can probably be put on the server side
-#
-##############################################################
-my $CheckoutTime_Wall = GetRegex "([0-9.]+)", `grep '^real' $COLog`;
-my $CheckoutTime_User = GetRegex "([0-9.]+)", `grep '^user' $COLog`;
-my $CheckoutTime_Sys = GetRegex "([0-9.]+)", `grep '^sys' $COLog`;
-my $CheckoutTime_CPU = $CVSCheckoutTime_User + $CVSCheckoutTime_Sys;
-
-my $NumFilesInCVS = 0;
-my $NumDirsInCVS = 0;
-if ($USESVN) {
- $NumFilesInCVS = `egrep '^A' $COLog | wc -l` + 0;
- $NumDirsInCVS = `sed -e 's#/[^/]*\$##' $COLog | sort | uniq | wc -l` + 0;
-} else {
- $NumFilesInCVS = `egrep '^U' $COLog | wc -l` + 0;
- $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $COLog | wc -l` + 0;
-}
-
-##############################################################
-#
-# Extract some information from the CVS history... use a hash so no duplicate
-# stuff is stored. This gets the history from the previous days worth
-# of cvs activity and parses it.
-#
-##############################################################
-
-# This just computes a reasonably accurate #of seconds since 2000. It doesn't
-# have to be perfect as its only used for comparing date ranges within a couple
-# of days.
-sub ConvertToSeconds {
- my ($sec, $min, $hour, $day, $mon, $yr) = @_;
- my $Result = ($yr - 2000) * 12;
- $Result += $mon;
- $Result *= 31;
- $Result += $day;
- $Result *= 24;
- $Result += $hour;
- $Result *= 60;
- $Result += $min;
- $Result *= 60;
- $Result += $sec;
- return $Result;
-}
-
-my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated);
-
-if (!$NOCVSSTATS) {
- if ($VERBOSE) { print "CHANGE HISTORY ANALYSIS STAGE\n"; }
-
- if ($USESVN) {
- @SVNHistory = split /<logentry/, `svn log --non-interactive --xml --verbose -r{$DATE}:HEAD`;
- # Skip very first entry because it is the XML header cruft
- shift @SVNHistory;
- my $Now = time();
- foreach $Record (@SVNHistory) {
- my @Lines = split "\n", $Record;
- my ($Author, $Date, $Revision);
- # Get the date and see if its one we want to process.
- my ($Year, $Month, $Day, $Hour, $Min, $Sec);
- if ($Lines[3] =~ /<date>(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})/){
- $Year = $1; $Month = $2; $Day = $3; $Hour = $4; $Min = $5; $Sec = $6;
- }
- my $Then = ConvertToSeconds($Sec, $Min, $Hour, $Day, $Month, $Year);
- # Get the current date and compute when "yesterday" is.
- my ($NSec, $NMin, $NHour, $NDay, $NMon, $NYear) = gmtime();
- my $Now = ConvertToSeconds( $NSec, $NMin, $NHour, $NDay, $NMon, $NYear);
- if (($Now - 24*60*60) > $Then) {
- next;
- }
- if ($Lines[1] =~ / revision="([0-9]*)">/) {
- $Revision = $1;
- }
- if ($Lines[2] =~ /<author>([^<]*)<\/author>/) {
- $Author = $1;
- }
- $UsersCommitted{$Author} = 1;
- $Date = $Year . "-" . $Month . "-" . $Day;
- $Time = $Hour . ":" . $Min . ":" . $Sec;
- print "Rev: $Revision, Author: $Author, Date: $Date, Time: $Time\n";
- for ($i = 6; $i < $#Lines; $i += 2 ) {
- if ($Lines[$i] =~ /^ action="(.)">([^<]*)</) {
- if ($1 == "A") {
- $AddedFiles{$2} = 1;
- } elsif ($1 == 'D') {
- $RemovedFiles{$2} = 1;
- } elsif ($1 == 'M' || $1 == 'R' || $1 == 'C') {
- $ModifiedFiles{$2} = 1;
- } else {
- print "UNMATCHABLE: $Lines[$i]\n";
- }
- }
- }
- }
- } else {
- @CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`;
-#print join "\n", @CVSHistory; print "\n";
-
- my $DateRE = '[-/:0-9 ]+\+[0-9]+';
-
-# Loop over every record from the CVS history, filling in the hashes.
- foreach $File (@CVSHistory) {
- my ($Type, $Date, $UID, $Rev, $Filename);
- if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) {
- ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5");
- } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) {
- ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "");
- } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) {
- ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/");
- } else {
- print "UNMATCHABLE: $File\n";
- next;
- }
- # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n";
-
- if ($Filename =~ /^llvm/) {
- if ($Type eq 'M') { # Modified
- $ModifiedFiles{$Filename} = 1;
- $UsersCommitted{$UID} = 1;
- } elsif ($Type eq 'A') { # Added
- $AddedFiles{$Filename} = 1;
- $UsersCommitted{$UID} = 1;
- } elsif ($Type eq 'R') { # Removed
- $RemovedFiles{$Filename} = 1;
- $UsersCommitted{$UID} = 1;
- } else {
- $UsersUpdated{$UID} = 1;
- }
- }
- }
-
- my $TestError = 1;
- } #$USESVN
-}#!NOCVSSTATS
-
-my $CVSAddedFiles = join "\n", sort keys %AddedFiles;
-my $CVSModifiedFiles = join "\n", sort keys %ModifiedFiles;
-my $CVSRemovedFiles = join "\n", sort keys %RemovedFiles;
-my $UserCommitList = join "\n", sort keys %UsersCommitted;
-my $UserUpdateList = join "\n", sort keys %UsersUpdated;