cvsuser 02/01/25 12:35:05
Added: P5EEx/Blue/sbin cvshistory
Log:
new file which creates the CVS activity web page
Revision Changes Path
1.1 p5ee/P5EEx/Blue/sbin/cvshistory
Index: cvshistory
===================================================================
#!/usr/local/bin/perl
#############################################################################
## $Id: cvshistory,v 1.1 2002/01/25 20:35:05 spadkins Exp $
#############################################################################
#print "Updating the CVS repository...\n";
$cmd = "cvs -Q update -dP > /dev/null 2>&1";
system($cmd);
#print "Examining the CVS logs...\n";
$cmd = "cvs -Q log 2> /dev/null |";
open(LOG, $cmd) || die "Unable to execute [$cmd]\n";
$state = "";
while (<LOG>) {
#print "Line: $_";
if ($state eq "file") {
if (/^==========/) {
$state = "";
}
elsif (/^----------/ || /^revision /) {
if (/^revision /) {
$rev = $_;
}
else {
$rev = <LOG>;
}
$change = <LOG>;
chomp($rev);
chomp($change);
$comment = "";
$line = <LOG>;
chomp($line);
while ($line !~ /^===========/ && $line !~ /^----------/) {
$comment .= $line;
$comment .= " ";
$line = <LOG>;
chomp($line);
}
if ($line =~ /^==========/) {
$state = "";
}
#print " rev: $rev\n";
#print " change: $change\n";
#print " comment: $comment\n";
$rev =~ s/revision *//;
$date = "[unknown]";
if ($change =~ m!date: *(..../../..) (..:..:..)!) {
$date = $1;
$time = $2;
$datetime = "$date $time";
}
$author = "[unknown]";
if ($change =~ m!author: *([a-zA-Z0-9_]+)!) {
$author = $1;
}
# date: 2001/11/22 05:16:59; author: spadkins; state: dead; lines: +5
-2
if ($change =~ /state: dead/ || $dead{$file}) {
$dead{$file} = 1 if (! $dead{$file});
next;
}
if ($change =~ m!lines: *\+([0-9]+) +\-([0-9]+)!) {
$lines = $1 + $2;
}
else {
$lines = `wc -l $file`;
chomp($lines);
$lines =~ s/^ *//;
$lines =~ s/ .*//;
}
$area = "p5ee";
if ($file =~ m!^(P5EEx/[^/]+)/!) {
$area = $1;
}
elsif ($file =~ m!^(P5EE/)!) {
$area = "P5EE";
}
#printf "$date $time %4s %10s %9s %-14s %s [%s]\n", $rev, $author,
$lines, $area, $file, $comment;
if (!defined $areas{$area}) {
push(@areas, $area);
$areas{$area}{datetime} = $datetime;
}
else {
if ($areas{$area}{datetime} lt $datetime) {
$areas{$area}{datetime} = $datetime;
}
}
$commit = "$date|$author|$area";
$areas{$area}{commit}{$commit}{date} = $date;
$areas{$area}{commit}{$commit}{lines} += $lines;
$areas{$area}{commit}{$commit}{$comment}{time} = $time;
$areas{$area}{commit}{$commit}{$comment}{file}{$file}{rev} = $rev;
$areas{$area}{commit}{$commit}{$comment}{file}{$file}{lines} = $lines;
}
}
else {
if (/^Working file: *(.*)/) {
$file = $1;
$state = "file";
}
}
}
close(LOG);
sub by_last_commit_date {
($areas{$a}{datetime} cmp $areas{$b}{datetime});
}
sub by_comment_time {
($areas{$area}{commit}{$commit}{$a}{time} cmp
$areas{$area}{commit}{$commit}{$b}{time});
}
print <<EOF;
<html>
<head>
<title>P5EE - CVS Activity</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body bgcolor="white" link="#690020" alink="#003600" vlink="#900000">
<h1>P5EE - CVS Activity</h1>
<hr>
<h2>CVS Areas</h2>
<blockquote>
<table border=1 cellspacing=0 cellpadding=3>
<tr>
<th align=left>Area</th>
<th align=left>Last Commit Date</th>
</tr>
EOF
foreach $area (reverse sort by_last_commit_date @areas) {
$datetime = $areas{$area}{datetime};
print <<EOF;
<tr>
<td nowrap valign=top><a href='#$area'>$area</a></td>
<td nowrap valign=top>$datetime</td>
</tr>
EOF
}
print "</table>\n</blockquote>\n\n";
foreach $area (reverse sort by_last_commit_date @areas) {
$date = $areas{$area}{datetime};
print "<a name='$area'><h2>$area</h2></a>\n";
print "<blockquote>\n";
print <<EOF;
<table border=1 cellspacing=0 cellpadding=3>
<tr>
<th align=left>Commit Date</th>
<th align=left>Author</th>
<th align=right>Lines</th>
<th align=left>Activity</th>
</tr>
EOF
foreach $commit (reverse sort keys %{$areas{$area}{commit}}) {
($date, $author, $area2) = split(/\|/, $commit);
$lines = $areas{$area}{commit}{$commit}{lines};
print <<EOF;
<tr>
<td nowrap valign=top>$date</td>
<td nowrap valign=top>$author</td>
<td nowrap valign=top align=right>$lines</td>
<td valign=top>
EOF
@comments = (reverse sort by_comment_time keys
%{$areas{$area}{commit}{$commit}});
#print STDERR "comments: [", join(",",@comments), "]\n";
foreach $comment (@comments) {
$time = $areas{$area}{commit}{$commit}{$comment}{time};
if (defined $time) {
print " $time $comment\n";
@files = (sort keys
%{$areas{$area}{commit}{$commit}{$comment}{file}});
#print STDERR "files: [$comment] [", join(",",@files), "]\n";
foreach $file (@files) {
$rev =
$areas{$area}{commit}{$commit}{$comment}{file}{$file}{rev};
$shortfile = $file;
$shortfile =~ s!P5EEx/[^/]+/!!;
$prevrev = "";
if ($rev =~ /^(.*)\.([0-9]+)$/) {
if ($2 > 1) {
$prevrev = "$1." . ($2-1);
}
}
if ($prevrev) {
print " <a
href='http://cvs.perl.org/cgi/cvsweb.cgi/p5ee/$file.diff?r1=$prevrev&r2=$rev&f=h'>$shortfile</a>";
}
else {
print " $shortfile";
}
print " <a
href='http://cvs.perl.org/cvsweb/p5ee/$file?rev=$rev&content-type=text/x-cvsweb-markup'>[$rev]</a>\n";
}
print " <br>\n";
}
}
print " </td>\n";
print " </tr>\n";
}
print "</table>\n";
print "</blockquote>\n";
}
print <<EOF;
</body>
</html>
EOF