+−# $Hg: hgkw/hgkwencode.py,v$ +− +−import re, sys +− +−def kwencode(): +− '''Truncates keywords in IO stream.''' +− +− re_kwtrunc = re.compile(r'([$]Hg: .+?,v) [a-z0-9]{12} [^$]+? \$') +− sys.stdout.write(re_kwtrunc.sub(r'\1$', sys.stdin.read()))