|
|
| (2 intermediate revisions by the same user not shown) |
| Line 1: |
Line 1: |
| − | #!/usr/bin/perl
| + | {{svn|tools|svn-results.pl}} |
| − | # Generate report of number of SVN committers by month
| + | [[Category:PERL]] |
| − | #{{perl}}
| |
| − | 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";
| |
| − | }
| |