svn-shortlog — Compact & Beautiful Subversion Changelog

At work we periodically have short developer meetings to discuss what has happened in the last month. To do this, we go through the bugs in our issue tracking system, and the subversion commits in our repository. Unfortunately, getting an overview of the subversion commits was rather cumbersome, and we could not find any efficient tool to do this. Hence, svn-shortlog was born.

This is an attempt to format the subversion log of a one-month period in the following way:

  • Beautiful HTML output.
  • Compact representation of lots of information
  • Usable with a not-so color rich beamer.
  • Fully automatic.

Usage

  1. Install Ruby (both 1.8 or 1.9 should work).
  2. Download svn-shortlog.rb.
  3. Open svn-shortlog.rb with your favourite text editor, and configure the config section according to your needs.
  4. Doubleclick svn-shortlog.rb
  5. Open the generated changelog_....html file with your favourite browser.

Sample Output

Here is a sample output of one month of boost commits into trunk, taken from the public repository. The output is quite information dense, a quick description is in the screenshot:

All commits are structured by user, then by date. Each commit is on one line. You can click each line to see the full information related to a commit.

Issues

Ideas, suggestions, problems? Please post them as a comment here, at the bug tracker.

Credits

This tool is based on the idea from my colleague Christoph Heindl and inspired by Linus’ Kernel shortlog and Gmail.

How to Generate Random Colors Programmatically

Creating random colors is actually more difficult than it seems. The randomness itself is easy, but aesthetically pleasing randomness is more difficult. For a little project at work I needed to automatically generate multiple background colors with the following properties:

  • Text over the colored background should be easily readable
  • Colors should be very distinct
  • The number of required colors is not initially known

Naïve Approach

The first and simplest approach is to create random colors by simply using a random number between [0, 256[ for the R, G, B values. I have created a little Ruby script to generate sample HTML code:

The generated output looks like this:

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

As you can see this is quite suboptimal. Some letters are hard to read because the background is too dark (B, Q, S), other colors look very similar (F, R).

Using HSV Color Space

HSV_cylinder_smallLet’s fix the too dark / too bright problem first. A convenient way to do this is to not use the RGB color space, but HSV (Hue, Saturation, Value). Here you get equally bright and colorful colors by using a fixed value for saturation and value, and just modifying the hue.

Based on the description provided by the wikipedia article on conversion from HSV to RGB I have implemented a converter:

Using the generator and fixed values for saturation and value:

returns something like this:

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Much better. The text is easily readable, and all colors have a similar brightness. Unfortunately, since we have limited us to less colors now, the difference between the randomly generated colors is even less than in the first approach.

Golden Ratio

Using just rand() to choose different values for hue does not lead to a good use of the whole color spectrum, it simply is too random.

distribution-random

Here I have generated 2, 4, 8, 16, and 32 random values and printed them all on a scale. Its easy to see that some values are very tightly packed together, which we do not want.

Lo and behold, some mathematician has discovered the Golden Ratio more than 2400 years ago. It has lots of interesting properties, but for us only one is interesting:

[…] Furthermore, it is a property of the golden ratio, Φ, that each subsequent hash value divides the interval into which it falls according to the golden ratio!
Bruno R. Preiss, P.Eng.

Using the golden ratio as the spacing, the generated values look like this:

distribution-goldenratio

Much better! The values are very evenly distributed, regardless how many values are used. Also, the algorithm for this is extremely simple. Just add 1/Φ and modulo 1 for each subsequent color.

The final result:

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

You can see that the first few values are very different, and the difference decreases as more colors are added (Z and E are already quite similar). Anyways, this is good enough for me.

And because it is so beautiful, here are some more colors 😉
s=0.99, v=0.99, s=0.25, h=0.8, and s=0.3, v=0.99

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Have fun!
Martin