(to be determined) home

Python script to plot histogram of commit frequency of Mercurial or Git repository

When I choose a open-source software from several projects, I’d want to choose more active one. Although some repository service like Google Code provides “activity” information, that was not enough for me because:

  1. I want to know same activity measurement across the projects.
  2. I can’t see activity if the repository service does not provides information anyway.
  3. It’d be better to know that if the repository has high “activity” continuously.

So, I wrote a simple Python script to plot a histogram of commit frequency (number of commit per day).

The figure bellow is an example. It is the histogram of the Numpy repository. You can see, for example, that it became very active since 2006.

repo-act-numpy by takafumi_a, on Flickr

For your information, this Python script can read any (point process) data if it is a sequence of an unix time per line. Please let me know if you have some other use of this script!

You can find the script at tkf’s gist: 913543 — Gist or bottom of this post.

Usage

Execute this at working directory of the repository of which you want to know the commit frequency.

hg log --template '{date}\\n' | datehist.py
git log --format='%at' | datehist.py

datehist.py can read the data (the output of hg log or git log) like this from stdin:

1298586880
1298516219
1298426531
1298426393
1298418897
1298407083
1298387222
1298387170
1295910432
(... and so on)

This is a sequence of unix time separated by new line \n.

You can specify the plot title from the command line option -t. For example, if you want to use the full path of the working directory as the title:

hg log --template '{date}\\n' | datehist.py -t `hg root`
git log --format='%at' | datehist.py -t `git rev-parse --show-toplevel`

Application: Which distributed bug tracking system is active?

I compared the following projects:

  1. b
  2. Bugs Everywhere
  3. Ditz
  4. pitz

screenshot-2011-04-04-185810 by takafumi_a, on Flickr

Hmmm… Looks like none of them is very active.

I’m using b for some reason.

datehist.py

You can get the newest one from tkf’s gist: 913543 — Gist.

Note: It looks like you need a local repository to see its log.

blog comments powered by Disqus