-
Notifications
You must be signed in to change notification settings - Fork 10
/
daniel-vs-rest.pl
65 lines (57 loc) · 1.72 KB
/
daniel-vs-rest.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/perl
my $c=0;
open(G, "git log --reverse --pretty=fuller --no-color --date=short --decorate=full --stat|");
while(<G>) {
chomp;
my $line = $_;
if($line =~ /^CommitDate: (\d\d\d\d-\d\d)/) {
$date = $1; # year + month
$commit{$author,$date}++;
$total{$author}++;
$when{$date}++;
$c++;
}
elsif($line =~ /^Author: *([^\<]*) \</) {
$author=$1;
if($author ne "Daniel Stenberg") {
$author = "else";
}
$uniq{$author}++;
}
elsif($line =~ /^ (\d*) file(|s) changed, (.*)/) {
my $d=$3;
my $adds=0;
my $dels=0;
$d =~ s/, //; #remove comma
if($d =~ s/(\d*) insertion(s|)\(\+\)//) {
$adds = $1;
}
if($d =~ s/(\d*) deletion(s|)\(\-\)//) {
$dels = $1;
}
#print STDERR "$date $author += $lines\n";
$add{$author, $date} += $adds;
$del{$author, $date} += $dels;
}
}
close(G);
for my $date (sort keys %when) {
#print STDERR "$date: $when{$date}\n";
$alld += $commit{"Daniel Stenberg", $date};
$alltot += $when{$date};
$dadd += $add{"Daniel Stenberg", $date};
$alladd += $add{"Daniel Stenberg", $date} +
$add{"else", $date};
my $addshare = 100;
$addshare = $dadd / $alladd * 100 if($alladd);
$ddel += $del{"Daniel Stenberg", $date};
$alldel += $del{"Daniel Stenberg", $date} +
$del{"else", $date};
my $delshare = 100;
$delshare = $ddel / $alldel * 100 if($alldel);
printf "$date-01;%.2f;%.2f;%.2f;%.2f;%.2f\n",
($alld/$alltot * 100),
100 - ($alld/$alltot * 100),
$commit{"Daniel Stenberg", $date}/$when{$date} * 100,
$addshare, $delshare;
}