hgkw/hgkwdecode.py
branchdecodefilter
changeset 4 7e618d820490
child 14 b60345141aa5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgkw/hgkwdecode.py	Thu Dec 14 08:35:24 2006 +0100
@@ -0,0 +1,14 @@
+# $Hg: hgkwdecode.py,v$
+
+from mercurial.demandload import demandload
+demandload(globals(), 'hgkw:kwutil mercurial:localrepo re sys')
+
+def kwdecode():
+    '''Expands keywords into IO stream.'''
+
+    lr = localrepo.localrepository(None)
+
+    kword = kwutil.mkkw(lr, tip=False, node='')
+    re_kw = kwutil.rekw()
+
+    sys.stdout.write(re_kw.sub(kword, sys.stdin.read()))