[PATCH] bookmark: run 'pushkey' hooks after bookmark move, not 'prepushkey'
Boris Feld
boris.feld at octobus.net
Mon Jan 15 16:37:01 UTC 2018
# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1516013089 0
# Mon Jan 15 10:44:49 2018 +0000
# Node ID 4d0d11752cf1d6e0f60bc3c9cc3d036dfa36e0a9
# Parent ebf14075a5c113f4fea6e89a4394d8c8fc9e6935
# EXP-Topic fix-book
# Available At https://bitbucket.org/octobus/mercurial-devel/
# hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 4d0d11752cf1
bookmark: run 'pushkey' hooks after bookmark move, not 'prepushkey'
This was a silly copy paste mistake.
Spotted by Mitchell Plamann from Jane Street.
diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -2022,7 +2022,7 @@ def handlebookmark(op, inpart):
if pushkeycompat:
def runhook():
for hookargs in allhooks:
- op.repo.hook('prepushkey', **hookargs)
+ op.repo.hook('pushkey', **hookargs)
op.repo._afterlock(runhook)
elif bookmarksmode == 'records':
diff --git a/tests/test-bundle2-exchange.t b/tests/test-bundle2-exchange.t
--- a/tests/test-bundle2-exchange.t
+++ b/tests/test-bundle2-exchange.t
@@ -253,6 +253,9 @@ push
remote: added 1 changesets with 0 changes to 0 files (-1 heads)
remote: 1 new obsolescence markers
remote: pre-close-tip:eea13746799a public book_eea1
+ remote: pushkey: lock state after "bookmark"
+ remote: lock: free
+ remote: wlock: free
remote: postclose-tip:eea13746799a public book_eea1
remote: txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NEW_OBSMARKERS=1 HG_NODE=eea13746799a9e0bfd88f29d3c2e9dc9389f524f HG_NODE_LAST=eea13746799a9e0bfd88f29d3c2e9dc9389f524f HG_PHASES_MOVED=1 HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_TXNNAME=push HG_URL=file:$TESTTMP/other
updating bookmark book_eea1
@@ -336,6 +339,9 @@ push over ssh
remote: added 1 changesets with 1 changes to 1 files
remote: 1 new obsolescence markers
remote: pre-close-tip:5fddd98957c8 draft book_5fdd
+ remote: pushkey: lock state after "bookmark"
+ remote: lock: free
+ remote: wlock: free
remote: postclose-tip:5fddd98957c8 draft book_5fdd
remote: txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NEW_OBSMARKERS=1 HG_NODE=5fddd98957c8a54a4d436dfe1da9d87f21a1b97b HG_NODE_LAST=5fddd98957c8a54a4d436dfe1da9d87f21a1b97b HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_TXNNAME=serve HG_URL=remote:ssh:$LOCALIP
updating bookmark book_5fdd
@@ -384,6 +390,9 @@ push over http
remote: added 1 changesets with 1 changes to 1 files
remote: 1 new obsolescence markers
remote: pre-close-tip:32af7686d403 public book_32af
+ remote: pushkey: lock state after "bookmark"
+ remote: lock: free
+ remote: wlock: free
remote: postclose-tip:32af7686d403 public book_32af
remote: txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NEW_OBSMARKERS=1 HG_NODE=32af7686d403cf45b5d95f2d70cebea587ac806a HG_NODE_LAST=32af7686d403cf45b5d95f2d70cebea587ac806a HG_PHASES_MOVED=1 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_TXNNAME=serve HG_URL=remote:http:$LOCALIP: (glob)
updating bookmark book_32af
diff --git a/tests/test-hook.t b/tests/test-hook.t
--- a/tests/test-hook.t
+++ b/tests/test-hook.t
@@ -244,6 +244,7 @@ pushkey hook
no changes found
pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=push
pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_TXNNAME=push HG_URL=file:$TESTTMP/a
+ pushkey hook: HG_BUNDLE2=1 HG_HOOKNAME=pushkey HG_HOOKTYPE=pushkey HG_KEY=foo HG_NAMESPACE=bookmark HG_NEW=0000000000000000000000000000000000000000 HG_PUSHKEYCOMPAT=1 HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_TXNNAME=push HG_URL=file:$TESTTMP/a
exporting bookmark foo
[1]
More information about the Mercurial-devel
mailing list