4 echo "Usage: $0 <output folder> [geometry]" >&2;
9 echo "Outputting to image $output"
11 if [ -e $output ]; then
12 echo "Output directory $output already exists" >&2;
24 git log
-C --numstat --reverse --pretty=format
:"%H %an" | perl
-e '
29 my $output = ".gitblaai";
30 mkdir($output) or die("Failed to create directory $output. Exiting.\n");
36 my ($file, $ins, $del) = @_;
39 if( exists $files{ $file } ) {
40 my $prevsize = $files{$file}[ $#{ $files{$file} } ];
41 # print "ADD $file prev = $prevsize";
47 for($i = 0; $i < $ncommits; ++$i ) {
48 push( @{ $files{$file} }, 0 );
53 $size += ($ins - $del);
54 # print " => $size ($commit)\n";
55 push( @{ $files{$file} }, $size );
61 if( not exists $files{ $old } ) {
62 print STDERR "$old does not exist\n";
64 $files{ $new } = $files{ $old };
65 delete $files{ $old };
68 # print "MV \"$old\" \"$new\"\n";
73 foreach $file (keys %files) {
74 if( $#{ $files{ $file } } < $ncommits ) {
75 my $prevsize = $files{$file}[ $#{ $files{$file} } ];
76 push( @{ $files{$file} }, $prevsize );
82 if( $_ =~ /^[0-9]+[\t ]+[0-9]+\s+\{[\w\/]+ => [\w\/]+\}\// ) {
83 my ($ins, $del, $fromdir, $todir, $file) = split(/[\s\{(=>)\}]+/, $_);
84 &rename_file("$fromdir$file", "$todir$file");
85 } elsif( $_ =~ /^\d+\s+\d+\s+[\w\/]+\{[\w\.\/]+ => [\w\.\/]+\}/ ) {
86 my ($ins, $del, $path, $from, $to) = split(/[\s\{(=>)\}]+/, $_);
87 print "RENAME $path,$from,$to\n";
88 &rename_file("$path$from", "$path$to");
90 my $file = "$path$to";
91 &add_commit($file, $ins, $del);
92 } elsif( $_ =~ /^[0-9]+[\t ]+[0-9]+/ ) {
93 my ($ins, $del, $file, $arrow, $new) = split;
94 if( $arrow eq "=>" ) {
95 &rename_file($file, $new);
99 &add_commit($file, $ins, $del);
100 } elsif( $_ =~ /^[0-9a-z]+/ ) {
101 if( $ncommits != 1 ) {
105 ($commit, $author) = split(/\s+/, $_, 2);
111 foreach $file (keys %files) {
112 my $filename = $file;
113 $filename =~ s/\//_/g;
114 open( FILE, ">>$output/$filename" );
116 for $i ( 0 .. $#{ $files{$file} } ) {
117 print FILE "$file $files{$file}[$i]\n";
126 ls $output/ |
while read file; do
129 set terminal png nocrop medium size $x,$y
130 set output '$output/$file.png'
131 plot "$output/$file" using 2 with points