Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 34709:c212947273a7
bookmark: add a dedicated pretxnclose-bookmark hook
This new hook mirror the newly introduced 'txnclose-bookmark' but can abort the
transaction.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Sun, 08 Oct 2017 18:50:14 +0200 |
parents | ee5f0d047b41 |
children | cdf833d7de98 |
comparison
equal
deleted
inserted
replaced
34708:ee5f0d047b41 | 34709:c212947273a7 |
---|---|
1233 # other families of changes (bookmarks, phases, obsolescence). | 1233 # other families of changes (bookmarks, phases, obsolescence). |
1234 # | 1234 # |
1235 # This will have to be fixed before we remove the experimental | 1235 # This will have to be fixed before we remove the experimental |
1236 # gating. | 1236 # gating. |
1237 tracktags(tr2) | 1237 tracktags(tr2) |
1238 reporef().hook('pretxnclose', throw=True, | 1238 repo = reporef() |
1239 txnname=desc, **pycompat.strkwargs(tr.hookargs)) | 1239 if hook.hashook(repo.ui, 'pretxnclose-bookmark'): |
1240 for name, (old, new) in sorted(tr.changes['bookmarks'].items()): | |
1241 args = tr.hookargs.copy() | |
1242 args.update(bookmarks.preparehookargs(name, old, new)) | |
1243 repo.hook('pretxnclose-bookmark', throw=True, | |
1244 txnname=desc, | |
1245 **pycompat.strkwargs(args)) | |
1246 | |
1247 repo.hook('pretxnclose', throw=True, | |
1248 txnname=desc, **pycompat.strkwargs(tr.hookargs)) | |
1240 def releasefn(tr, success): | 1249 def releasefn(tr, success): |
1241 repo = reporef() | 1250 repo = reporef() |
1242 if success: | 1251 if success: |
1243 # this should be explicitly invoked here, because | 1252 # this should be explicitly invoked here, because |
1244 # in-memory changes aren't written out at closing | 1253 # in-memory changes aren't written out at closing |