--- a/hgkw/keyword.py Thu Dec 21 16:58:28 2006 +0100
+++ b/hgkw/keyword.py Thu Dec 21 19:52:25 2006 +0100
@@ -1,3 +1,43 @@
+# keyword.py - keyword expansion for mercurial
+#
+# Copyright 2006 Christian Ebert <blacktrash@gmx.net>
+#
+# This software may be used and distributed according to the terms
+# of the GNU General Public License, incorporated herein by reference.
+
+'''keyword expansion hack against the grain of a DSCM
+
+This extension lets you expand RCS/CVS-like keywords in a Mercurial
+repository.
+
+There are many good reasons why this is not needed in a distributed
+SCM, still it may be useful in very small projects based on single
+files (like LaTeX packages), that are mostly addressed to an audience
+not running version control.
+
+The extension consists actually in 2 parts:
+
+ 1. extension code (reposetup) that is triggered on checkout and
+ logging of changes.
+ 2. a pretxncommit hook (hgrc (5)) that expands keywords immediately
+ at commit time in the working directory.
+
+Simple setup in hgrc:
+
+ # enable extension
+ hgext.keyword =
+
+ # filename patterns for expansion are configured in this section
+ [keyword]
+ *.sty = expand
+ ...
+
+ # set up pretxncommit hook
+ [hooks]
+ pretxncommit =
+ pretxncommit.keyword = python:hgext.keyword.pretxnkw
+'''
+
from mercurial.i18n import _
from mercurial import commands, cmdutil, context, filelog, revlog, util
import os.path, re, sys