Mercurial > hg
comparison mercurial/phases.py @ 34710:cdf833d7de98
phase: add a dedicated txnclose-phase hook
The new 'txnclose-phase' hook expose the phase movement information stored in
'tr.changes['phases]'. To provide a simple and straightforward hook API to the
users, we introduce a new hook called for each revision affected. Since a
transaction can affect the phase of multiple changesets, updating the existing
'txnclose' hook to expose that information would be more complex. The data for
all moves will 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 changesets.
This does not exclude the addition of the full phase movement information to
the existing 'txnclose' in the future to help write more complex hooks.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Sun, 08 Oct 2017 17:50:46 +0200 |
parents | 1faa34347b24 |
children | e2c42f751b06 |
comparison
equal
deleted
inserted
replaced
34709:c212947273a7 | 34710:cdf833d7de98 |
---|---|
630 raise error.ConfigError(msg % v) | 630 raise error.ConfigError(msg % v) |
631 | 631 |
632 def hassecret(repo): | 632 def hassecret(repo): |
633 """utility function that check if a repo have any secret changeset.""" | 633 """utility function that check if a repo have any secret changeset.""" |
634 return bool(repo._phasecache.phaseroots[2]) | 634 return bool(repo._phasecache.phaseroots[2]) |
635 | |
636 def preparehookargs(node, old, new): | |
637 if old is None: | |
638 old = '' | |
639 else: | |
640 old = '%s' % old | |
641 return {'node': node, | |
642 'oldphase': old, | |
643 'phase': '%s' % new} |