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 kwexpander
def pretxnkw(ui, repo, hooktype, **args):
'''Important: returns False on success, True on failure.'''
if hooktype != 'pretxncommit':
# bail out with error
return True
tip = repo.changelog.tip()
modified, added = repo.status()[:2]
candidates = modified + added
# TODO: check whether we need parent1&2 like in updatekw
return kwexpander.expandkw(ui, repo,
tip, args['node'][0:12], candidates, update=False)