comparison 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
comparison
equal deleted inserted replaced
34710:cdf833d7de98 34711:f6d17075608f
1241 args = tr.hookargs.copy() 1241 args = tr.hookargs.copy()
1242 args.update(bookmarks.preparehookargs(name, old, new)) 1242 args.update(bookmarks.preparehookargs(name, old, new))
1243 repo.hook('pretxnclose-bookmark', throw=True, 1243 repo.hook('pretxnclose-bookmark', throw=True,
1244 txnname=desc, 1244 txnname=desc,
1245 **pycompat.strkwargs(args)) 1245 **pycompat.strkwargs(args))
1246 if hook.hashook(repo.ui, 'pretxnclose-phase'):
1247 cl = repo.unfiltered().changelog
1248 for rev, (old, new) in tr.changes['phases'].items():
1249 args = tr.hookargs.copy()
1250 node = hex(cl.node(rev))
1251 args.update(phases.preparehookargs(node, old, new))
1252 repo.hook('pretxnclose-phase', throw=True, txnname=desc,
1253 **pycompat.strkwargs(args))
1246 1254
1247 repo.hook('pretxnclose', throw=True, 1255 repo.hook('pretxnclose', throw=True,
1248 txnname=desc, **pycompat.strkwargs(tr.hookargs)) 1256 txnname=desc, **pycompat.strkwargs(tr.hookargs))
1249 def releasefn(tr, success): 1257 def releasefn(tr, success):
1250 repo = reporef() 1258 repo = reporef()