How to use Activity extension of Mercurial

Display of activities on a Mercurial repository
Display of activities on a Mercurial repository

The Punchcard extension of Mercurial can be used to obtain a calendar chart of your contributions to a repository, as shown in here. If you need to view the classic line graph of activities in a Mercurial repository, then the Activity extension is a great solution.

  • This extension uses Matplotlib and requires a recent version. Matplotlib that ships with Ubuntu is typically ancient, so uninstall that and install the latest using pip:
$ sudo apt-get purge python-matplotlib python-matplotlib-data
$ sudo pip install --upgrade matplotlib
  • Clone the repository of the Activity extension to get the latest source code:
$ hg clone
  • Add lines to your hgrc to use this extension:
  • To view line graph of activities on your repository in an interactive GUI:
$ hg activity --mode=gui

You can view commits, branches, tags and users. Activities across different files and directories can be viewed by choosing options in the GUI.

  • To generate an image file named activity.png of this line graph:
$ hg activity --mode=file
  • If you find yourself using one of these activity options a lot, you could create an alias for it by adding these lines to your hgrc:
gact = activity --mode=gui

After this, you can use the alias instead of the more verbose form:

$ hg gact

Tried with: Mercurial 2.8.2, Matplotlib 1.5.0 and Ubuntu 14.04

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.