Make keyword do my hgkeyword; use basename again
add() needs only str.replace().
TODO:
Make even more compatible with cvs' $Id$? (date UTC, slashes)
Check config before reading.
And!:
Use config file patterns, in cooperation with pretxnkw.
This will expand keywords alread on commit!
# $Hg$
import re, sys
def kwencode():
'''Truncates hg keywords in IO stream
from
<Dollar>Hg: <filename> <cset id> <stuff> <Dollar>
to
<Dollar>Hg<Dollar>.'''
kwrepl = r'%sHg$' % '$'
re_kwtrunc = re.compile(r'[$]Hg: .+?,v [a-z0-9]{12} [^$]+? \$')
sys.stdout.write(re_kwtrunc.sub(kwrepl, sys.stdin.read()))