We have decided to use the awesome gource to visualize the history of MonoGame‘s github repository and the output is fascinating!

So here is how we did;

Step 1 – fetching avatars

To download available avatars for commiters, we used the gravatar script provided in gource’s related wiki page.

#!/usr/bin/perl
#fetch Gravatars

use strict;
use warnings;

use LWP::Simple;
use Digest::MD5 qw(md5_hex);
use Thread::Pool::Simple;

my $size       = 90;
my $output_dir = '.git/avatar';

system("no .git/ directory found in current path\n") unless -d '.git';

mkdir($output_dir) unless -d $output_dir;

open(GITLOG, q/git log --pretty=format:"%ae|%an" |/) or die("failed to read git-log: $!\n");

my %processed_authors;

sub fetch
{
    #try and fetch image
    my ($name, $email, $author_image_file) = @_;
    my $grav_url = "http://www.gravatar.com/avatar/".md5_hex(lc $email)."?d=404&s=".$size;

    warn "fetching image for '$name' $email ($grav_url)...\n";

    my $rc = getstore($grav_url, $author_image_file);
    if($rc != 200) {
        unlink($author_image_file);
    }
}

my $pool = Thread::Pool::Simple->new(min => 10, max => 20, do => [\&fetch]);

while() {
    chomp;
    my($email, $author) = split(/\|/, $_);

    next if $processed_authors{$author}++;

    my $author_image_file = $output_dir . '/' . $author . '.png';
    #skip images we have
    next if -e $author_image_file;

    $pool->add(($author, $email, $author_image_file));
}
$pool->join();

close GITLOG;

 Step 2 – run the gource over git repository

E:\dev-software\gource\gource --hide filenames --title "MonoGame Git Visualization" --user-image-dir E:\Source\[email protected]\.git\avatar --logo logo.png --seconds-per-day 0.01 -1280x720 -e 0.5 -o monogame.ppm E:\Source\[email protected]

Step 3 – render the video with ffmpeg

E:\dev-software\gource\ffmpeg\bin\ffmpeg -y -r 60 -f image2pipe -vcodec ppm -i monogame.ppm -vcodec libx264 -preset ultrafast -crf 18 -pix_fmt yuv420p -threads 0 -bf 0 monogame.avi

Bingo!