The 'update' hook is invoked too soon for bookmark changes
Jonathan Watt
jwatt at jwatt.org
Mon Sep 3 19:46:53 UTC 2018
The 'update' hook is a "run after" hook (unlike 'preupdate'), so my expectation
was that the hook would be able to see the repo in the state that it will be
left after 'hg update' returns. However, say I add the following to my .hgrc:
[hooks]
update = hg log -r . --template="{activebookmark}\n"
it becomes clear that this hook is invoked before 'hg update my-bookmark' has
marked the bookmark 'my-bookmark' as active. Similarly, if I 'hg update
<some-rev-id>', the hook will print out the name of the bookmark that is being
deactivated, rather than the expected empty string.
Is this a bug?
Backing up a bit, what I actually want to do is create an extension that adds a
revset predicate to get the name of the currently active or last activate
bookmark. To do that I need to record when the active bookmark changes, and the
'update' hook seems like the only way to do that (baring the issue described).
Any other suggestions are welcome.
Jonathan
More information about the Mercurial
mailing list