Skip to content

Commit a5c2f50

Browse files
committed
daniel-vs-rest: add graphs for added and removed lines
1 parent cea40c0 commit a5c2f50

File tree

2 files changed

+48
-14
lines changed

2 files changed

+48
-14
lines changed

daniel-vs-rest.pl

+35-4
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
my $c=0;
44

5-
open(G, "git log --reverse --pretty=fuller --no-color --date=short --decorate=full|");
5+
open(G, "git log --reverse --pretty=fuller --no-color --date=short --decorate=full --stat|");
66

77
while(<G>) {
88
chomp;
99
my $line = $_;
1010
if($line =~ /^CommitDate: (\d\d\d\d-\d\d)/) {
11-
my $date = $1; # year + month
11+
$date = $1; # year + month
1212
$commit{$author,$date}++;
1313
$total{$author}++;
1414
$when{$date}++;
@@ -21,14 +21,45 @@
2121
}
2222
$uniq{$author}++;
2323
}
24+
elsif($line =~ /^ (\d*) file(|s) changed, (.*)/) {
25+
my $d=$3;
26+
my $adds=0;
27+
my $dels=0;
28+
$d =~ s/, //; #remove comma
29+
if($d =~ s/(\d*) insertion(s|)\(\+\)//) {
30+
$adds = $1;
31+
}
32+
if($d =~ s/(\d*) deletion(s|)\(\-\)//) {
33+
$dels = $1;
34+
}
35+
36+
#print STDERR "$date $author += $lines\n";
37+
$add{$author, $date} += $adds;
38+
$del{$author, $date} += $dels;
39+
}
2440
}
2541
close(G);
2642

2743
for my $date (sort keys %when) {
44+
#print STDERR "$date: $when{$date}\n";
2845
$alld += $commit{"Daniel Stenberg", $date};
2946
$alltot += $when{$date};
30-
printf "$date-01;%.2f;%.2f;%.2f\n",
47+
48+
$dadd += $add{"Daniel Stenberg", $date};
49+
$alladd += $add{"Daniel Stenberg", $date} +
50+
$add{"else", $date};
51+
my $addshare = 100;
52+
$addshare = $dadd / $alladd * 100 if($alladd);
53+
54+
$ddel += $del{"Daniel Stenberg", $date};
55+
$alldel += $del{"Daniel Stenberg", $date} +
56+
$del{"else", $date};
57+
my $delshare = 100;
58+
$delshare = $ddel / $alldel * 100 if($alldel);
59+
60+
printf "$date-01;%.2f;%.2f;%.2f;%.2f;%.2f\n",
3161
($alld/$alltot * 100),
3262
100 - ($alld/$alltot * 100),
33-
$commit{"Daniel Stenberg", $date}/$when{$date} * 100;
63+
$commit{"Daniel Stenberg", $date}/$when{$date} * 100,
64+
$addshare, $delshare;
3465
}

daniel-vs-rest.plot

+13-10
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,26 @@
22
set terminal svg size 1920,1080 dynamic font ",24"
33

44
# title
5-
set title "Daniel's share of commits" font ",48"
5+
set title "Daniel Stenberg's share of commits" font ",48"
66
# where's the legend
77
set key top right
88

99
# Identify the axes
1010
#set xlabel "Time"
11-
set ylabel "Percentage of git commits"
11+
set ylabel "Percentage"
1212

1313
set style line 1 \
14-
linecolor rgb '#0060ad' \
15-
linetype 1 linewidth 5
16-
set style line 2 \
1714
linecolor rgb '#40c040' \
1815
linetype 1 linewidth 5
16+
set style line 2 \
17+
linecolor rgb '#0060ad' \
18+
linetype 1 linewidth 2
1919
set style line 3 \
2020
linecolor rgb '#a0a0a0' \
2121
linetype 3 linewidth 1
22+
set style line 4 \
23+
linecolor rgb '#c04040' \
24+
linetype 3 linewidth 2
2225

2326
set grid
2427
unset border
@@ -31,15 +34,15 @@ set ytics 10
3134
set yrange [0:]
3235
set xrange ["1999-10-01":]
3336

34-
set boxwidth 0.2 relative
37+
set boxwidth 0.5 relative
3538
set style fill solid
3639

3740
# set the format of the dates on the x axis
3841
set format x "%Y"
3942
set xtics rotate 3600*24*365.25
4043

4144
set datafile separator ";"
42-
plot 'tmp/daniel-vs-rest.csv' using 1:4 with boxes linestyle 3 title "Daniel's monthly share", \
43-
'tmp/daniel-vs-rest.csv' using 1:2 with lines linestyle 1 title "Daniel Stenberg accumulated", \
44-
'tmp/daniel-vs-rest.csv' using 1:3 with lines linestyle 2 title "Everyone else accumulated"
45-
45+
plot 'tmp/daniel-vs-rest.csv' using 1:4 with boxes linestyle 3 title "Monthly share of commit count", \
46+
'tmp/daniel-vs-rest.csv' using 1:2 with lines linestyle 1 title "share of commit count", \
47+
'tmp/daniel-vs-rest.csv' using 1:5 with lines linestyle 4 title "share of added lines", \
48+
'tmp/daniel-vs-rest.csv' using 1:6 with lines linestyle 2 title "share of removed lines"

0 commit comments

Comments
 (0)