9 open GNUPLOT, "|gnuplot -persist";
10 $data = "/tmp/commit-graph-$$.dat";
11 print "Using file $data\n";
14 GNUPLOT->autoflush(1);
18 set format x "%y/%m/%d"
24 open MAILMAP,`git rev-parse --show-cdup`.".mailmap";
27 # Determin which authors commited something
28 @author_list = `git log --pretty=format:"%an <%ae>" @ARGV|sort -u`;
33 ($author, $email) = @_;
35 if (!defined $emails{$2}) {
42 foreach $a(@author_list) {
44 ($an, $ae) = $a =~ /(.*) <(.*)>/;
49 if (/\s*([^<]*) <(.*)>\s*$/) {
55 print STDERR "Unhandled mailmap line: $_\n";
58 add_author($an, $ae) unless $mailmapped;
60 #print Dumper({%authors});
62 foreach $author(sort keys %authors) {
63 @emails = keys %{ $authors{$author} };
64 $email_re = '\('.join('\|', @emails).'\)';
66 $cmd = qq/git log --pretty=format:"commit %ct %s" --author='$email_re' --no-merges --reverse --numstat @ARGV/;
73 if (/^commit (\d+)/) { $time=$1; $num_commits++; $printed=0; }
74 elsif (/(\d+)\s+(\d+)/) {
77 print DATA "$time $num_commits $added_lines\n";
81 if ($num_commits > 0) {
83 print DATA "$time $num_commits $added_lines\n";
87 delete $authors{$author};
94 foreach $author(sort keys %authors) {
95 push @plots, qq/"$data" index $i using 1:2 with linespoints title "$author"/;
98 print GNUPLOT "set ylabel \"Number of commits\"\n";
99 print GNUPLOT "plot ", join(", ", @plots), ";\n";
103 foreach $author(sort keys %authors) {
104 push @plots, qq/"$data" index $i using 1:3 with linespoints title "$author"/;
107 print GNUPLOT "set ylabel \"Added lines\"\n";
108 # print GNUPLOT "set logscale y\n";
109 print GNUPLOT "plot ", join(", ", @plots), ";\n";