Monday, September 5, 2011

Software Version Control Visualization - Gource

I've been playing around with visualizations since some time. You might remember my post about GlassFish City where I did a visualization with CodeCity. I came across another great visualization tool called Gource. It paints an animated tree of your projects repository history with the root directory of the project at its center.
Directories appear as branches with files as leaves. Developers can be seen working on the tree at the times they contributed to the project. The animation looks nice and you have a lot of options to configure the look and feel. The most interesting part is to generate short (or long :)) videos from the journey your team has taken through the project. And there is also a way to do this. Specifying the -o (aka --output-ppm-stream) option let's Gource write an uncompressed sequence of screenshots in PPM format which can then be processed by a video encoder to produce a video.
The most basic example could be done with SVN, because SVN support is build in with Gource since 0.29.

svn log -r 1:HEAD --xml --verbose --quiet > my-project-log.xml

Next is to run gource on this:

gource my-project-log.xml

Now you have a nice UI where you cann simply watch whats happening or even drag around a bit to see what your team members were doing. If you are looking into creating a video you have to simply run gource in streaming mode:

gource my-project-log.xml -f --hide usernames -o neutral.ppm


If you think about publishing it ... please hide the details (as shown above) and you could also think about tightening the timeline a bit.

--seconds-per-day 0.1 --auto-skip-seconds 0.1 


After you are done, you have a more or less big file on your hdd which needs to be processed with your video encoder of choice. The most simple approach is to run your PPM stream through ffmpeg.
ffmpeg -an -y -f image2pipe -vcodec ppm -i neutral.ppm -vcodec libx264 -s 800x600 -r 30.000 -vb 8000000 final.mp4


That's all. Enjoy!