Svn-results.pl
From Organic Design wiki
- !/usr/bin/perl
- Generate report of number of SVN committers by month
- Our Perl scripts.
use Date::Parse;
$csv = '/var/www/svn-report.txt'; %data = ();
open CSV,'<',$csv; while (<CSV>) { ($revision,$date,$user,$core) = split ','; if ($date =~ /... (...) .. ..:..:.. (....)/ && $user) { @m = strptime("$1 $2"); $m = $m[4]+1; if ($m < 10) { $m = "0$m" } $data{"$2/$m"}{$user}{0+$core}++ } } close CSV;
print "$revision revisions read into hash\n";
for $date (sort { $a cmp $b } keys %data) {
@users = keys %{ $data{$date} }; $n = 1+$#users; $ncore = 0; $t = 0; $tcore = 0; for (@users) { if ($c = $data{$date}{$_}{1}) { $ncore++; $tcore += $c; } $t += $c + $data{$date}{$_}{0}; }
print "$date (users: $n,$ncore) (commits: $t,$tcore)\n"; }



