Mercurial > hg
comparison mercurial/bookmarks.py @ 34708:ee5f0d047b41
bookmark: add a dedicated txnclose-bookmark hook
The new 'txnclose-bookmark' hook expose the bookmark movement information
stored in 'tr.changes['bookmarks]'. To provide a simple and straightforward
hook API to the users, we introduce a new hook called for each bookmark
touched. Since a transaction can affect multiple bookmarks, updating the
existing 'txnclose' hook to expose that information would be more complex. The
data for all moves might not fit in environment variables and iterations over
each move would be cumbersome. So the introduction of a new dedicated hook is
preferred in this changeset.
This does not exclude the addition to the full bookmark information to the
existing 'txnclose' in the future to help write more complex hooks.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Tue, 10 Oct 2017 17:53:42 +0200 |
parents | 712a85b3677f |
children | 3340d46a5c3f |
comparison
equal
deleted
inserted
replaced
34707:6cd8d8203204 | 34708:ee5f0d047b41 |
---|---|
844 else: | 844 else: |
845 prefix, label = ' ', '' | 845 prefix, label = ' ', '' |
846 | 846 |
847 bmarks[bmark] = (n, prefix, label) | 847 bmarks[bmark] = (n, prefix, label) |
848 _printbookmarks(ui, repo, bmarks, **opts) | 848 _printbookmarks(ui, repo, bmarks, **opts) |
849 | |
850 def preparehookargs(name, old, new): | |
851 if new is None: | |
852 new = '' | |
853 if old is None: | |
854 old = '' | |
855 return {'bookmark': name, | |
856 'node': hex(new), | |
857 'oldnode': hex(old)} |