Implement $Hg$ scheme with update hook
The pivotal line for update hook is:
repo.dirstate.update(kwupdates, 'n')
This forces hg to consider the freshly written files as not modified.
Thanks to wfile(), this keeps executable bits etc.
Still needs more testing.
No need to check for basename/filename in keyword trigger.
update hook does not need re.
TODO:
Walk back in history, if last change of file didn't happen in 1
of the provided changesets (update/merge?)?
# $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()))