Mercurial > public > mercurial-scm > hg-stable
diff 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 |
line wrap: on
line diff
--- a/mercurial/phases.py Sun Oct 08 18:50:14 2017 +0200 +++ b/mercurial/phases.py Sun Oct 08 17:50:46 2017 +0200 @@ -632,3 +632,12 @@ def hassecret(repo): """utility function that check if a repo have any secret changeset.""" return bool(repo._phasecache.phaseroots[2]) + +def preparehookargs(node, old, new): + if old is None: + old = '' + else: + old = '%s' % old + return {'node': node, + 'oldphase': old, + 'phase': '%s' % new}