Keyword Expansion extension

This extension is not being distributed along with Mercurial.

Author: Christian Ebert

Download site: [http://www.blacktrash.org/hg/hgkeyword/ keyword expansion repository].

Mirror of crew repo plus keyword extension: [http://www.blacktrash.org/hg/hg-crew-keyword/ Mercurial crew + keyword].

Overview

This extension allows the expansion of RCS/CVS-like and user defined keys in text files tracked by Mercurial. Expansion takes place in the working directory or/and when creating a distribution using "hg archive".

Configuration

To enable this extension add it to the '[extensions]' stanza in the hgrc file:

[extensions]
hgext.keyword=
#or, if keyword.py is not in the hgext folder:
#keyword=/path/to/keyword.py

Additional configuration is done in the [keyword] and [keywordmaps] sections in your configuration file:

# filename patterns for expansion are configured in this section
[keyword]
# expand keywords in all python files in working dir
**.py =
# do not expand keywords in files matching "x*" in working dir
x* = ignore
...
# in case you prefer your own keyword maps over the cvs-like defaults:
# using "key-to-be-expanded = value" lines, where values are taken from the available Mercurial template names.
# an additional filter "utcdate" is provided to get "%Y/%m/%d %H:%M:%S" date format.
[keywordmaps]
HGdate = {date|rfc822date}
lastlog = {desc} ## same as {desc|firstline} in this context
checked in by = {author}

Usage

The defined keys (or default ones) are automatically expanded, without user interaction.


CategoryExtension