1. Justin Love
  2. stylish-mercurial-gource


-*- markdown -*-

# Mercurial for Gource

Producing repository log into the custom format
expected by [Gource](http://code.google.com/p/gource/)

Gource is a software version control visualization program.

## Method 1

Use stylish-mercurial-gource.py, which stands alone.


    ./stylish-mercurial-gource.py [HG_ARGS*] [OUTPUT_FILE]


- HG-ARGS are passed on to mercurial 'hg log' unmodified.
- OUTPUT_FILE is the output file for the custom log
- if OUTPUT_FILE is not provided, or '-', output to stdout
- '-' is required if using HG-ARGS to stdout

example usage with Gource (assuming that Gource is installed):

    ./stylish-mercurial-gource.py project.log && gource project.log


    ./stylish-mercurial-gource.py | gource --log-format custom -

but gource doesn't loop at the end when reading from stdin

    ./stylish-mercurial-gource.py -R ~/myrepo - | gource --log-format custom -

where -R is the mercurial option to set the repositiory root

This script should work for any mercurial repository (version number?),
The necessary style features appear to have introduced by mercurial 1.0

## Method 2

Add two lines to your .hgrc

    hgintdate = ~/path/to/hgintdate.py

    gource = log --style /absolute/path/to/gource.style -r 0:tip

You can then do

    hg gource > project.log
    hg gource | gource --log-format custom -

Additional options to log can be passed to the `hg gource` command.

### Variant A

Copy gource.style to your Mercurial templates directory as map-cmdline.gource, so you use `--style gource`

### Variant B

Remove `|intdate` (no need to install extension) from gource.style and just use sed

    hg gource | sed -E -e "s/\.[0-9+-]+//" | gource --log-format custom -