This is an extension for the mercurial source control management, which creates an image file displaying the activity of a repository. The activity is a rough estimates of when has the developement happened ?

hgactivity can use either the number of commits, or the number of lines modified/removed/added.

As an example, here is the activity for the different commiters (only the top 5 are displayed in the legend) on the mercurial repository itself :

And another one with the global activity for the repository:

You can find a lot of other images on the gallery

Where to get it ?

Grag the last official release from the files tab at the top of the page

If you want to use the very latest source (less tested, but quite probably safe enough to use), you can either clone it using:

hg clone

or grab a tarball (zip, bz2, tar.gz, ...) of the latest source at the top of the mercurial page :


Be sure to have matplotlib installed, check your distribution tools for this.
Then you need to extract the source somewhere (in my setup i use ~/hg/hgactivity/) and to tell mercurial about it, by adding a line like this one to ~/.hgrc, in the [extensions] section:


(use your actual path to the file, of course)

Windows user can refer to this blog entry

Usage and documentation

There are basically two main ways of using it. Either you want a GUI that displays the activity graph and where you can point-and-click options. You do :hg activity --mode=gui.

Or you want to generate an image. This is typical for headless (=screenless) systems such as servers. You then need to provide options through command line. This setup is typical when you want to display the activity of some repository on a webpage. This mode doesn't require any display library (X-window, Wayland or whatever).

As a convenience, when using the GUI, the corresponding command line options are displayed at the bottom of the window, and you can just copy/paste those.

You might want to read hg activity --help for more information. For less basic usage, there's a page dedicated to documentation.


Some tests are included. To run them just do


It should end with "OK"


It is always tested with the latest mercurial version (currently 4.x). It probably works with older versions as well. I use this extension daily, and my gentoo boxes are updated frequently, so be confident that it keeps on being maintained.

Updated by Thomas Capricelli about 6 years ago ยท 25 revisions