Comments
Patch
@@ -1904,7 +1904,31 @@ def handlebookmark(op, inpart):
for pull.
"""
changes = bookmarks.binarydecode(inpart)
- op.repo._bookmarks.applychanges(op.repo, op.gettransaction(), changes)
+
+ tr = op.gettransaction()
+ bookstore = op.repo._bookmarks
+
+ pushkeycompat = op.repo.ui.configbool('server', 'bookmarks-pushkey-compat')
+ if pushkeycompat:
+ allhooks = []
+ for book, node in changes:
+ hookargs = tr.hookargs.copy()
+ hookargs['pushkeycompat'] = '1'
+ hookargs['namespace'] = 'bookmark'
+ hookargs['key'] = book
+ hookargs['old'] = nodemod.hex(bookstore.get(book, ''))
+ hookargs['new'] = nodemod.hex(node if node is not None else '')
+ allhooks.append(hookargs)
+ for hookargs in allhooks:
+ op.repo.hook('prepushkey', throw=True, **hookargs)
+
+ bookstore.applychanges(op.repo, tr, changes)
+
+ if pushkeycompat:
+ def runhook():
+ for hookargs in allhooks:
+ op.repo.hook('prepushkey', **hookargs)
+ op.repo._afterlock(runhook)
@parthandler('phase-heads')
def handlephases(op, inpart):
@@ -745,6 +745,9 @@ coreconfigitem('progress', 'width',
coreconfigitem('push', 'pushvars.server',
default=False,
)
+coreconfigitem('server', 'bookmarks-pushkey-compat',
+ default=True,
+)
coreconfigitem('server', 'bundle1',
default=True,
)
@@ -1723,6 +1723,14 @@ Alias definitions for revsets. See :hg:`
Controls generic server settings.
+``bookmarks-pushkey-compat``
+ Trigger pushkey hook when being pushed bookmark updates. This config exist
+ for compatibility purpose (default to True)
+
+ If you use ``pushkey`` and ``pre-pushkey`` hooks to control bookmark
+ movement we recommend you migrate them to ``txnclose-bookmark`` and
+ ``pretxnclose-bookmark``.
+
``compressionengines``
List of compression engines and their relative priority to advertise
to clients.