Mercurial > hg
diff mercurial/localrepo.py @ 34711:f6d17075608f
phase: add a dedicated pretxnclose-phase hook
This new hook mirror the newly introduced 'txnclose-phase' but can abort the
transaction.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Sun, 08 Oct 2017 17:23:18 +0200 |
parents | cdf833d7de98 |
children | e2ad93bcc084 |
line wrap: on
line diff
--- a/mercurial/localrepo.py Sun Oct 08 17:50:46 2017 +0200 +++ b/mercurial/localrepo.py Sun Oct 08 17:23:18 2017 +0200 @@ -1243,6 +1243,14 @@ repo.hook('pretxnclose-bookmark', throw=True, txnname=desc, **pycompat.strkwargs(args)) + if hook.hashook(repo.ui, 'pretxnclose-phase'): + cl = repo.unfiltered().changelog + for rev, (old, new) in tr.changes['phases'].items(): + args = tr.hookargs.copy() + node = hex(cl.node(rev)) + args.update(phases.preparehookargs(node, old, new)) + repo.hook('pretxnclose-phase', throw=True, txnname=desc, + **pycompat.strkwargs(args)) repo.hook('pretxnclose', throw=True, txnname=desc, **pycompat.strkwargs(tr.hookargs))