blog

Mercurial: prettyconfig extension

# February 16, 2020

Since the Bitbucket migration, I’ve found myself tinkering1 with Mercurial and its extensions system again (after a long hiatus).

One byproduct of this was a simple, single function extension for listing aliases in a user-friendly way. I subsequently realised that the same behaviour would be useful for arbitrary config sections (aliases, paths, schemes)… and so, the prettyconfig fork.

The prettyconfig extension defines a single command, prettyconfig, for colourising and neatly displaying config values. Without arguments, all config name/value pairs are output, where names are qualified with section prefixes (akin to hg showconfig). Single sections are displayed with the -s (or --section) switch, e.g.:

$ hg prettyconfig  -s       alias   # display aliases
$ hg prettyconfig --section alias   # same thing

Colouring can be applied to the output by setting the following two labels in an .hgrc file (either globally or locally):

So far, I’ve found the following aliases2 useful enough to store globally in ~/.hgrc:

Hopefully others will find prettyconfig useful too. Feedback is welcome.


  1. Perusing APIs, making old extensions Python 3 compatible, tweaking web templates, etc.

  2. Note that the aliases alias effectively does the same thing as enabling hg-aliases (from which this extension was derived).


comments powered by Disqus