# HG changeset patch # User Christian Ebert # Date 1165958765 -3600 # Node ID 1d997ec7be8667a9bb0aeec2bfe3aa6d4f008063 # Parent 41c7e55cd9e96b1cdc3daf8fd2bf919af5587e4b Add simple [encode] filter in python The aim is to go for $Hg$ without basename. Perhaps this is feasable with update hooks &Co. No way to detect a filename while stream writing. Even though hg /knows/ the filenames, but does not provide an API or hook, unfortunately. diff -r 41c7e55cd9e9 -r 1d997ec7be86 hgkw/hgkwencode.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hgkw/hgkwencode.py Tue Dec 12 22:26:05 2006 +0100 @@ -0,0 +1,11 @@ +# $Hg: hgkwencode.py,v$ + +import re, sys + +#re_kwencode = re.compile(r'[$]Hg.*?[$]') +re_kwencode = re.compile(r'([$]Hg: .+?,v) [a-z0-9]{12} [^$]+? [$]') + +def hgkwencode(): + sys.stdout.write( + re_kwencode.sub(r'\1$', sys.stdin.read()) + ) diff -r 41c7e55cd9e9 -r 1d997ec7be86 hgkwencode --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hgkwencode Tue Dec 12 22:26:05 2006 +0100 @@ -0,0 +1,6 @@ +#!/usr/bin/env python +# $Hg: hgkwencode,v$ + +from hgkw import hgkwencode + +hgkwencode.hgkwencode()