|
|
| Line 1: |
Line 1: |
| − | #!/usr/bin/perl
| + | {{svn|tools|svn-results.pl}} |
| − | # Generate report of number of SVN committers by month
| |
| − | #{{perl}}
| |
| − | use Date::Format;
| |
| − | use Date::Parse;
| |
| − | | |
| − | $csv = '/var/www/svn-report.txt';
| |
| − | %data = ();
| |
| − | | |
| − | open CSV,'<',$csv;
| |
| − | while (<CSV>) {
| |
| − | ($revision,$date,$user,$core) = split ',';
| |
| − | if ($date =~ /... (...) .. ..:..:.. (....)/ && $user) {
| |
| − | $data{time2str('%Y/%m',str2time("1 $1 $2"))}{$user}{0+$core}++;
| |
| − | $data{time2str('%Y',str2time("1 $1 $2"))}{$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};
| |
| − | }
| |
| − | if ($date =~ /^....$/) {
| |
| − | print "\n|-\n|'''$date'''||'''$n'''||'''$ncore'''||'''$t'''||'''$tcore'''\n";
| |
| − | }
| |
| − | else {
| |
| − | $date = time2str('%B',str2time("$date/01"));
| |
| − | print "|-\n|$date||$n||$ncore||$t||$tcore\n";
| |
| − | }
| |
| − | } | |