Patchwork [2,of,5] bookmark: add a dedicated txnclose-bookmark hook

login
register
mail settings
Submitter Boris Feld
Date Oct. 9, 2017, 6:36 p.m.
Message ID <7a2a2f58094560b307ba.1507574180@FB>
Download mbox | patch
Permalink /patch/24663/
State Superseded
Headers show

Comments

Boris Feld - Oct. 9, 2017, 6:36 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1507480369 -7200
#      Sun Oct 08 18:32:49 2017 +0200
# Node ID 7a2a2f58094560b307ba7980904dd4fc0087eddb
# Parent  29bb94cd7a882b572324c07a7c2fdc974956e6e5
# EXP-Topic b2.phases.hooks
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 7a2a2f580945
bookmark: add a dedicated txnclose-bookmark hook

The new 'txnclose-bookmark' hook expose the bookmark movement information
stored in 'tr.changes['bookmarks]'. To provide a simple and straightforward
hook API to the users, we introduce a new hook called for each bookmark
touched. Since a transaction can affect multiple bookmarks, updating the
existing 'txnclose' hook to expose that information would be more complex. The
data for all moves might not fit in environment variables and iterations over
each move would be cumbersome. So the introduction of a new dedicated hook is
preferred in this changeset.

This does not exclude the addition to the full bookmark information to the
existing 'txnclose' in the future to help write more complex hooks.

Patch

diff -r 29bb94cd7a88 -r 7a2a2f580945 mercurial/help/config.txt
--- a/mercurial/help/config.txt	Sun Oct 08 13:08:31 2017 +0200
+++ b/mercurial/help/config.txt	Sun Oct 08 18:32:49 2017 +0200
@@ -982,6 +982,18 @@ 
   after the lock is released. See :hg:`help config.hooks.pretxnclose` for
   details about available variables.
 
+``txnclose-bookmark``
+  Run after any bookmark change has been committed. At this point, the
+  transaction can no longer be rolled back. The hook will run after the lock
+  is released.
+  The name of the bookmark will be available in ``$HG_BOOKMARK``, the new
+  bookmark location will be available in ``$HG_NODE`` while the previous
+  location will be available in ``$HG_OLDNODE``. In case of a bookmark
+  creation ``$HG_OLDNODE`` will be empty. In case of deletion ``$HG_NODE``
+  will be empty. In addition, the reason for the transaction opening will be
+  in ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
+  ``HG_TXNID``.
+
 ``txnabort``
   Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose`
   for details about available variables.
diff -r 29bb94cd7a88 -r 7a2a2f580945 mercurial/localrepo.py
--- a/mercurial/localrepo.py	Sun Oct 08 13:08:31 2017 +0200
+++ b/mercurial/localrepo.py	Sun Oct 08 18:32:49 2017 +0200
@@ -1280,10 +1280,25 @@ 
             # fixes the function accumulation.
             hookargs = tr2.hookargs
 
-            def hook():
-                reporef().hook('txnclose', throw=False, txnname=desc,
-                               **pycompat.strkwargs(hookargs))
-            reporef()._afterlock(hook)
+            def hookfunc():
+                repo = reporef()
+                if hook.hashook(repo.ui, 'txnclose-bookmark'):
+                    bmchanges = sorted(tr.changes['bookmarks'].items())
+                    for name, (old, new) in bmchanges:
+                        if new is None:
+                            new = ''
+                        if old is None:
+                            old = ''
+                        args = tr.hookargs.copy()
+                        args['bookmark'] = name
+                        args['node'] = hex(new)
+                        args['oldnode'] = hex(old)
+                        repo.hook('txnclose-bookmark', throw=False,
+                                  txnname=desc, **pycompat.strkwargs(args))
+
+                repo.hook('txnclose', throw=False, txnname=desc,
+                          **pycompat.strkwargs(hookargs))
+            reporef()._afterlock(hookfunc)
         tr.addfinalize('txnclose-hook', txnclosehook)
         tr.addpostclose('warms-cache', self._buildcacheupdater(tr))
         def txnaborthook(tr2):
diff -r 29bb94cd7a88 -r 7a2a2f580945 tests/test-bookmarks-pushpull.t
--- a/tests/test-bookmarks-pushpull.t	Sun Oct 08 13:08:31 2017 +0200
+++ b/tests/test-bookmarks-pushpull.t	Sun Oct 08 18:32:49 2017 +0200
@@ -7,6 +7,8 @@ 
   > publish=False
   > [experimental]
   > stabilization=createmarkers,exchange
+  > [hooks]
+  > txnclose-bookmark.test = echo "test-hook-bookmark: \$HG_BOOKMARK:  \$HG_OLDNODE -> \$HG_NODE"
   > EOF
 
 initialize
@@ -20,14 +22,18 @@ 
 set bookmarks
 
   $ hg bookmark X
+  test-hook-bookmark: X:   -> 4e3505fd95835d721066b76e75dbb8cc554d7f77
   $ hg bookmark Y
+  test-hook-bookmark: Y:   -> 4e3505fd95835d721066b76e75dbb8cc554d7f77
   $ hg bookmark Z
+  test-hook-bookmark: Z:   -> 4e3505fd95835d721066b76e75dbb8cc554d7f77
 
 import bookmark by name
 
   $ hg init ../b
   $ cd ../b
   $ hg book Y
+  test-hook-bookmark: Y:   -> 0000000000000000000000000000000000000000
   $ hg book
    * Y                         -1:000000000000
   $ hg pull ../a
@@ -40,6 +46,9 @@ 
   adding remote bookmark X
   updating bookmark Y
   adding remote bookmark Z
+  test-hook-bookmark: X:   -> 4e3505fd95835d721066b76e75dbb8cc554d7f77
+  test-hook-bookmark: Y:  0000000000000000000000000000000000000000 -> 4e3505fd95835d721066b76e75dbb8cc554d7f77
+  test-hook-bookmark: Z:   -> 4e3505fd95835d721066b76e75dbb8cc554d7f77
   (run 'hg update' to get a working copy)
   $ hg bookmarks
      X                         0:4e3505fd9583
@@ -58,10 +67,12 @@ 
 delete the bookmark to re-pull it
 
   $ hg book -d X
+  test-hook-bookmark: X:  4e3505fd95835d721066b76e75dbb8cc554d7f77 -> 
   $ hg pull -B X ../a
   pulling from ../a
   no changes found
   adding remote bookmark X
+  test-hook-bookmark: X:   -> 4e3505fd95835d721066b76e75dbb8cc554d7f77
 
 finally no-op pull
 
@@ -76,12 +87,16 @@ 
 export bookmark by name
 
   $ hg bookmark W
+  test-hook-bookmark: W:   -> 0000000000000000000000000000000000000000
   $ hg bookmark foo
+  test-hook-bookmark: foo:   -> 0000000000000000000000000000000000000000
   $ hg bookmark foobar
+  test-hook-bookmark: foobar:   -> 0000000000000000000000000000000000000000
   $ hg push -B W ../a
   pushing to ../a
   searching for changes
   no changes found
+  test-hook-bookmark: W:   -> 0000000000000000000000000000000000000000
   exporting bookmark W
   [1]
   $ hg -R ../a bookmarks
@@ -93,20 +108,24 @@ 
 delete a remote bookmark
 
   $ hg book -d W
+  test-hook-bookmark: W:  0000000000000000000000000000000000000000 -> 
   $ hg push -B W ../a
   pushing to ../a
   searching for changes
   no changes found
+  test-hook-bookmark: W:  0000000000000000000000000000000000000000 -> 
   deleting remote bookmark W
   [1]
 
 export the active bookmark
 
   $ hg bookmark V
+  test-hook-bookmark: V:   -> 0000000000000000000000000000000000000000
   $ hg push -B . ../a
   pushing to ../a
   searching for changes
   no changes found
+  test-hook-bookmark: V:   -> 0000000000000000000000000000000000000000
   exporting bookmark V
   [1]
 
@@ -126,10 +145,12 @@ 
 delete the bookmark
 
   $ hg book -d V
+  test-hook-bookmark: V:  0000000000000000000000000000000000000000 -> 
   $ hg push -B V ../a
   pushing to ../a
   searching for changes
   no changes found
+  test-hook-bookmark: V:  0000000000000000000000000000000000000000 -> 
   deleting remote bookmark V
   [1]
   $ hg up foobar
@@ -155,8 +176,11 @@ 
   $ echo c1 > f1
   $ hg ci -Am1
   adding f1
+  test-hook-bookmark: Z:  4e3505fd95835d721066b76e75dbb8cc554d7f77 -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
   $ hg book -f @
+  test-hook-bookmark: @:   -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
   $ hg book -f X
+  test-hook-bookmark: X:  4e3505fd95835d721066b76e75dbb8cc554d7f77 -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
   $ hg book
      @                         1:0d2164f0ce0d
    * X                         1:0d2164f0ce0d
@@ -167,11 +191,15 @@ 
   $ hg up
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   updating bookmark foobar
+  test-hook-bookmark: foobar:  0000000000000000000000000000000000000000 -> 4e3505fd95835d721066b76e75dbb8cc554d7f77
   $ echo c2 > f2
   $ hg ci -Am2
   adding f2
+  test-hook-bookmark: foobar:  4e3505fd95835d721066b76e75dbb8cc554d7f77 -> 9b140be1080824d768c5a4691a564088eede71f9
   $ hg book -if @
+  test-hook-bookmark: @:   -> 9b140be1080824d768c5a4691a564088eede71f9
   $ hg book -if X
+  test-hook-bookmark: X:  4e3505fd95835d721066b76e75dbb8cc554d7f77 -> 9b140be1080824d768c5a4691a564088eede71f9
   $ hg book
      @                         1:9b140be10808
      X                         1:9b140be10808
@@ -190,6 +218,9 @@ 
   divergent bookmark @ stored as @foo
   divergent bookmark X stored as X@foo
   updating bookmark Z
+  test-hook-bookmark: @foo:   -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
+  test-hook-bookmark: X@foo:   -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
+  test-hook-bookmark: Z:  4e3505fd95835d721066b76e75dbb8cc554d7f77 -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
   (run 'hg heads' to see heads, 'hg merge' to merge)
   $ hg book
      @                         1:9b140be10808
@@ -204,12 +235,113 @@ 
 (test that too many divergence of bookmark)
 
   $ $PYTHON $TESTDIR/seq.py 1 100 | while read i; do hg bookmarks -r 000000000000 "X@${i}"; done
+  test-hook-bookmark: X@1:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@2:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@3:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@4:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@5:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@6:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@7:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@8:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@9:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@10:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@11:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@12:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@13:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@14:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@15:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@16:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@17:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@18:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@19:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@20:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@21:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@22:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@23:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@24:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@25:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@26:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@27:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@28:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@29:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@30:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@31:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@32:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@33:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@34:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@35:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@36:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@37:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@38:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@39:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@40:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@41:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@42:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@43:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@44:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@45:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@46:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@47:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@48:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@49:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@50:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@51:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@52:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@53:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@54:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@55:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@56:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@57:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@58:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@59:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@60:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@61:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@62:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@63:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@64:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@65:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@66:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@67:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@68:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@69:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@70:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@71:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@72:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@73:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@74:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@75:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@76:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@77:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@78:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@79:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@80:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@81:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@82:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@83:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@84:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@85:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@86:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@87:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@88:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@89:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@90:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@91:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@92:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@93:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@94:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@95:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@96:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@97:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@98:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@99:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: X@100:   -> 0000000000000000000000000000000000000000
   $ hg pull ../a
   pulling from ../a
   searching for changes
   no changes found
   warning: failed to assign numbered name to divergent bookmark X
   divergent bookmark @ stored as @1
+  test-hook-bookmark: @1:   -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
   $ hg bookmarks | grep '^   X' | grep -v ':000000000000'
      X                         1:9b140be10808
      X@foo                     2:0d2164f0ce0d
@@ -226,13 +358,115 @@ 
   no changes found
   warning: failed to assign numbered name to divergent bookmark X
   divergent bookmark @ stored as @1
+  test-hook-bookmark: @1:  0d2164f0ce0d8f1d6f94351eba04b794909be66c -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
   $ hg bookmarks | grep '^   @'
      @                         1:9b140be10808
      @1                        2:0d2164f0ce0d
      @foo                      2:0d2164f0ce0d
 
   $ $PYTHON $TESTDIR/seq.py 1 100 | while read i; do hg bookmarks -d "X@${i}"; done
+  test-hook-bookmark: X@1:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@2:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@3:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@4:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@5:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@6:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@7:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@8:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@9:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@10:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@11:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@12:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@13:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@14:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@15:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@16:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@17:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@18:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@19:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@20:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@21:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@22:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@23:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@24:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@25:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@26:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@27:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@28:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@29:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@30:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@31:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@32:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@33:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@34:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@35:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@36:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@37:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@38:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@39:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@40:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@41:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@42:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@43:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@44:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@45:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@46:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@47:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@48:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@49:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@50:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@51:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@52:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@53:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@54:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@55:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@56:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@57:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@58:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@59:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@60:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@61:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@62:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@63:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@64:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@65:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@66:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@67:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@68:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@69:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@70:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@71:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@72:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@73:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@74:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@75:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@76:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@77:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@78:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@79:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@80:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@81:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@82:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@83:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@84:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@85:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@86:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@87:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@88:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@89:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@90:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@91:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@92:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@93:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@94:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@95:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@96:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@97:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@98:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@99:  0000000000000000000000000000000000000000 -> 
+  test-hook-bookmark: X@100:  0000000000000000000000000000000000000000 -> 
   $ hg bookmarks -d "@1"
+  test-hook-bookmark: @1:  0d2164f0ce0d8f1d6f94351eba04b794909be66c -> 
 
   $ hg push -f ../a
   pushing to ../a
@@ -257,14 +491,18 @@ 
   no changes found
   divergent bookmark @ stored as @foo
   importing bookmark X
+  test-hook-bookmark: @foo:  0d2164f0ce0d8f1d6f94351eba04b794909be66c -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
+  test-hook-bookmark: X:  9b140be1080824d768c5a4691a564088eede71f9 -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
 
 reinstall state for further testing:
 
   $ hg book -fr 9b140be10808 X
+  test-hook-bookmark: X:  0d2164f0ce0d8f1d6f94351eba04b794909be66c -> 9b140be1080824d768c5a4691a564088eede71f9
 
 revsets should not ignore divergent bookmarks
 
   $ hg bookmark -fr 1 Z
+  test-hook-bookmark: Z:  0d2164f0ce0d8f1d6f94351eba04b794909be66c -> 9b140be1080824d768c5a4691a564088eede71f9
   $ hg log -r 'bookmark()' --template '{rev}:{node|short} {bookmarks}\n'
   0:4e3505fd9583 Y
   1:9b140be10808 @ X Z foobar
@@ -281,6 +519,7 @@ 
   $ hg ci -Am3
   adding f2
   created new head
+  test-hook-bookmark: Y:  4e3505fd95835d721066b76e75dbb8cc554d7f77 -> f6fc62dde3c0771e29704af56ba4d8af77abcc2f
   $ hg push ../a
   pushing to ../a
   searching for changes
@@ -288,6 +527,7 @@ 
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files (+1 heads)
+  test-hook-bookmark: Y:  4e3505fd95835d721066b76e75dbb8cc554d7f77 -> f6fc62dde3c0771e29704af56ba4d8af77abcc2f
   updating bookmark Y
   $ hg -R ../a book
      @                         1:0d2164f0ce0d
@@ -313,10 +553,15 @@ 
   > EOF
 
   $ hg clone -q http://localhost:$HGPORT/ pull-race2
+  test-hook-bookmark: @:   -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
+  test-hook-bookmark: X:   -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
+  test-hook-bookmark: Y:   -> f6fc62dde3c0771e29704af56ba4d8af77abcc2f
+  test-hook-bookmark: Z:   -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
   $ cd pull-race
   $ hg up -q Y
   $ echo c4 > f2
   $ hg ci -Am4
+  test-hook-bookmark: Y:  f6fc62dde3c0771e29704af56ba4d8af77abcc2f -> b0a5eff05604a689fe742100f8534f8e9679df06
   $ echo c5 > f3
   $ cat <<EOF > .hg/hgrc
   > [hooks]
@@ -343,6 +588,7 @@ 
   adding file changes
   added 1 changesets with 1 changes to 1 files
   updating bookmark Y
+  test-hook-bookmark: Y:  f6fc62dde3c0771e29704af56ba4d8af77abcc2f -> b0a5eff05604a689fe742100f8534f8e9679df06
   (run 'hg update' to get a working copy)
   $ hg book
    * @                         1:0d2164f0ce0d
@@ -392,6 +638,7 @@ 
   adding file changes
   added 1 changesets with 1 changes to 1 files
   updating bookmark Y
+  test-hook-bookmark: Y:  b0a5eff05604a689fe742100f8534f8e9679df06 -> 35d1ef0a8d1b544c1e8609fc7e0e4fccb5bf5703
   (run 'hg update' to get a working copy)
   $ hg book
      @                         1:0d2164f0ce0d
@@ -428,6 +675,7 @@ 
   
 
   $ hg book -f Y
+  test-hook-bookmark: Y:  f6fc62dde3c0771e29704af56ba4d8af77abcc2f -> c922c0139ca03858f655e4a2af4dd02796a63969
 
   $ cat <<EOF > ../a/.hg/hgrc
   > [web]
@@ -486,6 +734,7 @@ 
   remote: added 2 changesets with 2 changes to 1 files (+1 heads)
   remote: 2 new obsolescence markers
   remote: obsoleted 1 changesets
+  remote: test-hook-bookmark: Y:  f6fc62dde3c0771e29704af56ba4d8af77abcc2f -> c922c0139ca03858f655e4a2af4dd02796a63969
   updating bookmark Y
   $ hg -R ../a book
      @                         1:0d2164f0ce0d
@@ -529,9 +778,11 @@ 
   pushing to http://localhost:$HGPORT/
   searching for changes
   no changes found
+  remote: test-hook-bookmark: Z:  9b140be1080824d768c5a4691a564088eede71f9 -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
   updating bookmark Z
   [1]
   $ hg book -d Z
+  test-hook-bookmark: Z:  0d2164f0ce0d8f1d6f94351eba04b794909be66c -> 
   $ hg in -B http://localhost:$HGPORT/
   comparing with http://localhost:$HGPORT/
   searching for changed bookmarks
@@ -548,6 +799,11 @@ 
   adding remote bookmark Z
   adding remote bookmark foo
   adding remote bookmark foobar
+  test-hook-bookmark: @1:   -> 9b140be1080824d768c5a4691a564088eede71f9
+  test-hook-bookmark: X@1:   -> 9b140be1080824d768c5a4691a564088eede71f9
+  test-hook-bookmark: Z:   -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
+  test-hook-bookmark: foo:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: foobar:   -> 9b140be1080824d768c5a4691a564088eede71f9
   $ hg clone http://localhost:$HGPORT/ cloned-bookmarks
   requesting all changes
   adding changesets
@@ -555,6 +811,12 @@ 
   adding file changes
   added 5 changesets with 5 changes to 3 files (+2 heads)
   2 new obsolescence markers
+  test-hook-bookmark: @:   -> 9b140be1080824d768c5a4691a564088eede71f9
+  test-hook-bookmark: X:   -> 9b140be1080824d768c5a4691a564088eede71f9
+  test-hook-bookmark: Y:   -> c922c0139ca03858f655e4a2af4dd02796a63969
+  test-hook-bookmark: Z:   -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
+  test-hook-bookmark: foo:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: foobar:   -> 9b140be1080824d768c5a4691a564088eede71f9
   updating to bookmark @
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg -R cloned-bookmarks bookmarks
@@ -586,11 +848,17 @@ 
   o  0:1ea73414a91b
   
   $ hg -R source bookmarks -r 0 SAME
+  test-hook-bookmark: SAME:   -> 1ea73414a91b0920940797d8fc6a11e447f8ea1e
   $ hg -R source bookmarks -r 0 ADV_ON_REPO1
+  test-hook-bookmark: ADV_ON_REPO1:   -> 1ea73414a91b0920940797d8fc6a11e447f8ea1e
   $ hg -R source bookmarks -r 0 ADV_ON_REPO2
+  test-hook-bookmark: ADV_ON_REPO2:   -> 1ea73414a91b0920940797d8fc6a11e447f8ea1e
   $ hg -R source bookmarks -r 0 DIFF_ADV_ON_REPO1
+  test-hook-bookmark: DIFF_ADV_ON_REPO1:   -> 1ea73414a91b0920940797d8fc6a11e447f8ea1e
   $ hg -R source bookmarks -r 0 DIFF_ADV_ON_REPO2
+  test-hook-bookmark: DIFF_ADV_ON_REPO2:   -> 1ea73414a91b0920940797d8fc6a11e447f8ea1e
   $ hg -R source bookmarks -r 1 DIVERGED
+  test-hook-bookmark: DIVERGED:   -> 66f7d451a68b85ed82ff5fcc254daf50c74144bd
 
   $ hg clone -U source repo1
 
@@ -609,9 +877,13 @@ 
   [1]
 
   $ hg -R repo1 bookmarks -f -r 1 ADD_ON_REPO1
+  test-hook-bookmark: ADD_ON_REPO1:   -> 66f7d451a68b85ed82ff5fcc254daf50c74144bd
   $ hg -R repo1 bookmarks -f -r 2 ADV_ON_REPO1
+  test-hook-bookmark: ADV_ON_REPO1:  1ea73414a91b0920940797d8fc6a11e447f8ea1e -> fa942426a6fdfa3e512ef78f0ea686aca7210ef7
   $ hg -R repo1 bookmarks -f -r 3 DIFF_ADV_ON_REPO1
+  test-hook-bookmark: DIFF_ADV_ON_REPO1:  1ea73414a91b0920940797d8fc6a11e447f8ea1e -> 6100d3090acf50ed11ec23196cec20f5bd7323aa
   $ hg -R repo1 bookmarks -f -r 3 DIFF_DIVERGED
+  test-hook-bookmark: DIFF_DIVERGED:   -> 6100d3090acf50ed11ec23196cec20f5bd7323aa
   $ hg -R repo1 -q --config extensions.mq= strip 4
   $ hg -R repo1 log -G --template '{node|short} ({bookmarks})'
   o  6100d3090acf (DIFF_ADV_ON_REPO1 DIFF_DIVERGED)
@@ -625,10 +897,15 @@ 
 
   $ hg clone -U source repo2
   $ hg -R repo2 bookmarks -f -r 1 ADD_ON_REPO2
+  test-hook-bookmark: ADD_ON_REPO2:   -> 66f7d451a68b85ed82ff5fcc254daf50c74144bd
   $ hg -R repo2 bookmarks -f -r 1 ADV_ON_REPO2
+  test-hook-bookmark: ADV_ON_REPO2:  1ea73414a91b0920940797d8fc6a11e447f8ea1e -> 66f7d451a68b85ed82ff5fcc254daf50c74144bd
   $ hg -R repo2 bookmarks -f -r 2 DIVERGED
+  test-hook-bookmark: DIVERGED:  66f7d451a68b85ed82ff5fcc254daf50c74144bd -> fa942426a6fdfa3e512ef78f0ea686aca7210ef7
   $ hg -R repo2 bookmarks -f -r 4 DIFF_ADV_ON_REPO2
+  test-hook-bookmark: DIFF_ADV_ON_REPO2:  1ea73414a91b0920940797d8fc6a11e447f8ea1e -> e7bd5218ca1581c6fbe5aca38649e8a36d742881
   $ hg -R repo2 bookmarks -f -r 4 DIFF_DIVERGED
+  test-hook-bookmark: DIFF_DIVERGED:   -> e7bd5218ca1581c6fbe5aca38649e8a36d742881
   $ hg -R repo2 -q --config extensions.mq= strip 3
   $ hg -R repo2 log -G --template '{node|short} ({bookmarks})'
   o  e7bd5218ca15 (DIFF_ADV_ON_REPO2 DIFF_DIVERGED)
@@ -691,20 +968,30 @@ 
   adding file changes
   added 5 changesets with 5 changes to 3 files (+2 heads)
   2 new obsolescence markers
+  test-hook-bookmark: @:   -> 9b140be1080824d768c5a4691a564088eede71f9
+  test-hook-bookmark: X:   -> 9b140be1080824d768c5a4691a564088eede71f9
+  test-hook-bookmark: Y:   -> c922c0139ca03858f655e4a2af4dd02796a63969
+  test-hook-bookmark: Z:   -> 0d2164f0ce0d8f1d6f94351eba04b794909be66c
+  test-hook-bookmark: foo:   -> 0000000000000000000000000000000000000000
+  test-hook-bookmark: foobar:   -> 9b140be1080824d768c5a4691a564088eede71f9
   updating to bookmark @
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd addmarks
   $ echo foo > foo
   $ hg add foo
   $ hg commit -m 'add foo'
+  test-hook-bookmark: @:  9b140be1080824d768c5a4691a564088eede71f9 -> 09dc0186084b616828dc2269c3d7af380b1358c1
   $ echo bar > bar
   $ hg add bar
   $ hg commit -m 'add bar'
+  test-hook-bookmark: @:  09dc0186084b616828dc2269c3d7af380b1358c1 -> f5d8c7a233fa7d5033e02b594076f33af488aecd
   $ hg co "tip^"
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   (leaving bookmark @)
   $ hg book add-foo
+  test-hook-bookmark: add-foo:   -> 09dc0186084b616828dc2269c3d7af380b1358c1
   $ hg book -r tip add-bar
+  test-hook-bookmark: add-bar:   -> f5d8c7a233fa7d5033e02b594076f33af488aecd
 Note: this push *must* push only a single changeset, as that's the point
 of this test.
   $ hg push -B add-foo --traceback
@@ -714,15 +1001,18 @@ 
   remote: adding manifests
   remote: adding file changes
   remote: added 1 changesets with 1 changes to 1 files
+  remote: test-hook-bookmark: add-foo:   -> 09dc0186084b616828dc2269c3d7af380b1358c1
   exporting bookmark add-foo
 
 pushing a new bookmark on a new head does not require -f if -B is specified
 
   $ hg up -q X
   $ hg book W
+  test-hook-bookmark: W:   -> 9b140be1080824d768c5a4691a564088eede71f9
   $ echo c5 > f2
   $ hg ci -Am5
   created new head
+  test-hook-bookmark: W:  9b140be1080824d768c5a4691a564088eede71f9 -> cc978a373a531d107b806e679d063f7259176740
   $ hg push -B .
   pushing to http://localhost:$HGPORT/
   searching for changes
@@ -730,6 +1020,7 @@ 
   remote: adding manifests
   remote: adding file changes
   remote: added 1 changesets with 1 changes to 1 files (+1 heads)
+  remote: test-hook-bookmark: W:   -> cc978a373a531d107b806e679d063f7259176740
   exporting bookmark W
   $ hg -R ../b id -r W
   cc978a373a53 tip W
@@ -740,11 +1031,13 @@ 
   $ hg up -q X
   $ echo 1 > f2
   $ hg ci -qAml
+  test-hook-bookmark: X:  9b140be1080824d768c5a4691a564088eede71f9 -> a2a606d9ff1bb7592a583683549b61a0441a7114
 
   $ cd ../r
   $ hg up -q X
   $ echo 2 > f2
   $ hg ci -qAmr
+  test-hook-bookmark: X:  9b140be1080824d768c5a4691a564088eede71f9 -> 54694f811df96bbdde8bb661aa2703af4fd44c25
   $ hg push -B X
   pushing to $TESTTMP/addmarks (glob)
   searching for changes
@@ -757,7 +1050,9 @@ 
 Check summary output for incoming/outgoing bookmarks
 
   $ hg bookmarks -d X
+  test-hook-bookmark: X:  a2a606d9ff1bb7592a583683549b61a0441a7114 -> 
   $ hg bookmarks -d Y
+  test-hook-bookmark: Y:  c922c0139ca03858f655e4a2af4dd02796a63969 -> 
   $ hg summary --remote | grep '^remote:'
   remote: *, 2 incoming bookmarks, 1 outgoing bookmarks (glob)
 
@@ -772,6 +1067,7 @@ 
   $ hg commit -A -m initial
   adding foo
   $ hg bookmark @
+  test-hook-bookmark: @:   -> 55482a6fb4b1881fa8f746fd52cf6f096bb21c89
   $ hg push -B @ ../unchanged-b
   pushing to ../unchanged-b
   searching for changes
@@ -779,6 +1075,7 @@ 
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files
+  test-hook-bookmark: @:   -> 55482a6fb4b1881fa8f746fd52cf6f096bb21c89
   exporting bookmark @
 
   $ hg push -B @ ../unchanged-b
diff -r 29bb94cd7a88 -r 7a2a2f580945 tests/test-bookmarks.t
--- a/tests/test-bookmarks.t	Sun Oct 08 13:08:31 2017 +0200
+++ b/tests/test-bookmarks.t	Sun Oct 08 18:32:49 2017 +0200
@@ -1,5 +1,10 @@ 
+
   $ hg init repo
   $ cd repo
+  $ cat << EOF >> .hg/hgrc
+  > [hooks]
+  > txnclose-bookmark.test = echo "test-hook-bookmark: \$HG_BOOKMARK:  \$HG_OLDNODE -> \$HG_NODE"
+  > EOF
 
 no bookmarks
 
@@ -13,6 +18,7 @@ 
 bookmark rev -1
 
   $ hg bookmark X
+  test-hook-bookmark: X:   -> 0000000000000000000000000000000000000000
 
 list bookmarks
 
@@ -28,6 +34,7 @@ 
   $ echo a > a
   $ hg add a
   $ hg commit -m 0
+  test-hook-bookmark: X:  0000000000000000000000000000000000000000 -> f7b1eb17ad24730a1651fccd46c43826d1bbc2ac
 
 bookmark X moved to rev 0
 
@@ -48,10 +55,12 @@ 
 second bookmark for rev 0, command should work even with ui.strict on
 
   $ hg --config ui.strict=1 bookmark X2
+  test-hook-bookmark: X2:   -> f7b1eb17ad24730a1651fccd46c43826d1bbc2ac
 
 bookmark rev -1 again
 
   $ hg bookmark -r null Y
+  test-hook-bookmark: Y:   -> 0000000000000000000000000000000000000000
 
 list bookmarks
 
@@ -63,6 +72,7 @@ 
   $ echo b > b
   $ hg add b
   $ hg commit -m 1
+  test-hook-bookmark: X2:  f7b1eb17ad24730a1651fccd46c43826d1bbc2ac -> 925d80f479bb026b0fb3deb27503780b13f74123
 
   $ hg bookmarks -Tjson
   [
@@ -158,6 +168,7 @@ 
 bookmark rev 0 again
 
   $ hg bookmark -r 0 Z
+  test-hook-bookmark: Z:   -> f7b1eb17ad24730a1651fccd46c43826d1bbc2ac
 
   $ hg update X
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -166,6 +177,7 @@ 
   $ hg add c
   $ hg commit -m 2
   created new head
+  test-hook-bookmark: X:  f7b1eb17ad24730a1651fccd46c43826d1bbc2ac -> db815d6d32e69058eadefc8cffbad37675707975
 
 bookmarks X moved to rev 2, Y at rev -1, Z at rev 0
 
@@ -190,11 +202,16 @@ 
 force rename to existent bookmark
 
   $ hg bookmark -f -m X Y
+  test-hook-bookmark: X:  db815d6d32e69058eadefc8cffbad37675707975 -> 
+  test-hook-bookmark: Y:  0000000000000000000000000000000000000000 -> db815d6d32e69058eadefc8cffbad37675707975
 
 rename bookmark using .
 
   $ hg book rename-me
+  test-hook-bookmark: rename-me:   -> db815d6d32e69058eadefc8cffbad37675707975
   $ hg book -m . renamed
+  test-hook-bookmark: rename-me:  db815d6d32e69058eadefc8cffbad37675707975 -> 
+  test-hook-bookmark: renamed:   -> db815d6d32e69058eadefc8cffbad37675707975
   $ hg bookmark
      X2                        1:925d80f479bb
      Y                         2:db815d6d32e6
@@ -202,21 +219,26 @@ 
    * renamed                   2:db815d6d32e6
   $ hg up -q Y
   $ hg book -d renamed
+  test-hook-bookmark: renamed:  db815d6d32e69058eadefc8cffbad37675707975 -> 
 
 rename bookmark using . with no active bookmark
 
   $ hg book rename-me
+  test-hook-bookmark: rename-me:   -> db815d6d32e69058eadefc8cffbad37675707975
   $ hg book -i rename-me
   $ hg book -m . renamed
   abort: no active bookmark
   [255]
   $ hg up -q Y
   $ hg book -d rename-me
+  test-hook-bookmark: rename-me:  db815d6d32e69058eadefc8cffbad37675707975 -> 
 
 delete bookmark using .
 
   $ hg book delete-me
+  test-hook-bookmark: delete-me:   -> db815d6d32e69058eadefc8cffbad37675707975
   $ hg book -d .
+  test-hook-bookmark: delete-me:  db815d6d32e69058eadefc8cffbad37675707975 -> 
   $ hg bookmark
      X2                        1:925d80f479bb
      Y                         2:db815d6d32e6
@@ -226,12 +248,14 @@ 
 delete bookmark using . with no active bookmark
 
   $ hg book delete-me
+  test-hook-bookmark: delete-me:   -> db815d6d32e69058eadefc8cffbad37675707975
   $ hg book -i delete-me
   $ hg book -d .
   abort: no active bookmark
   [255]
   $ hg up -q Y
   $ hg book -d delete-me
+  test-hook-bookmark: delete-me:  db815d6d32e69058eadefc8cffbad37675707975 -> 
 
 list bookmarks
 
@@ -242,7 +266,9 @@ 
 
 bookmarks from a revset
   $ hg bookmark -r '.^1' REVSET
+  test-hook-bookmark: REVSET:   -> f7b1eb17ad24730a1651fccd46c43826d1bbc2ac
   $ hg bookmark -r ':tip' TIP
+  test-hook-bookmark: TIP:   -> db815d6d32e69058eadefc8cffbad37675707975
   $ hg up -q TIP
   $ hg bookmarks
      REVSET                    0:f7b1eb17ad24
@@ -252,7 +278,9 @@ 
      Z                         0:f7b1eb17ad24
 
   $ hg bookmark -d REVSET
+  test-hook-bookmark: REVSET:  f7b1eb17ad24730a1651fccd46c43826d1bbc2ac -> 
   $ hg bookmark -d TIP
+  test-hook-bookmark: TIP:  db815d6d32e69058eadefc8cffbad37675707975 -> 
 
 rename without new name or multiple names
 
@@ -278,6 +306,7 @@ 
 bookmark name with spaces should be stripped
 
   $ hg bookmark ' x  y '
+  test-hook-bookmark: x  y:   -> db815d6d32e69058eadefc8cffbad37675707975
 
 list bookmarks
 
@@ -359,8 +388,12 @@ 
   (did you leave a -r out of an 'hg bookmark' command?)
   bookmark db815d6d32e6 matches a changeset hash
   (did you leave a -r out of an 'hg bookmark' command?)
+  test-hook-bookmark: 925d80f479bb:   -> db815d6d32e69058eadefc8cffbad37675707975
+  test-hook-bookmark: db815d6d32e6:   -> db815d6d32e69058eadefc8cffbad37675707975
   $ hg bookmark -d 925d80f479bb
+  test-hook-bookmark: 925d80f479bb:  db815d6d32e69058eadefc8cffbad37675707975 -> 
   $ hg bookmark -d db815d6d32e6
+  test-hook-bookmark: db815d6d32e6:  db815d6d32e69058eadefc8cffbad37675707975 -> 
 
   $ cd ..
 
@@ -407,10 +440,12 @@ 
 force bookmark with existing name
 
   $ hg bookmark -f X2
+  test-hook-bookmark: X2:  925d80f479bb026b0fb3deb27503780b13f74123 -> db815d6d32e69058eadefc8cffbad37675707975
 
 force bookmark back to where it was, should deactivate it
 
   $ hg bookmark -fr1 X2
+  test-hook-bookmark: X2:  db815d6d32e69058eadefc8cffbad37675707975 -> 925d80f479bb026b0fb3deb27503780b13f74123
   $ hg bookmarks
      X2                        1:925d80f479bb
      Y                         2:db815d6d32e6
@@ -421,6 +456,7 @@ 
 
   $ hg bookmark Z
   moving bookmark 'Z' forward from f7b1eb17ad24
+  test-hook-bookmark: Z:  f7b1eb17ad24730a1651fccd46c43826d1bbc2ac -> db815d6d32e69058eadefc8cffbad37675707975
 
 list bookmarks
 
@@ -487,8 +523,10 @@ 
 
   $ echo foo > f1
   $ hg bookmark tmp-rollback
+  test-hook-bookmark: tmp-rollback:   -> db815d6d32e69058eadefc8cffbad37675707975
   $ hg ci -Amr
   adding f1
+  test-hook-bookmark: tmp-rollback:  db815d6d32e69058eadefc8cffbad37675707975 -> 2bf5cfec5864a07e71c9d3a2a96f5c9766595ba1
   $ hg bookmarks
      X2                        1:925d80f479bb
      Y                         2:db815d6d32e6
@@ -505,6 +543,7 @@ 
    * tmp-rollback              2:db815d6d32e6
      x  y                      2:db815d6d32e6
   $ hg bookmark -f Z -r 1
+  test-hook-bookmark: Z:  db815d6d32e69058eadefc8cffbad37675707975 -> 925d80f479bb026b0fb3deb27503780b13f74123
   $ hg rollback
   repository tip rolled back to revision 2 (undo bookmark)
   $ hg bookmarks
@@ -514,16 +553,21 @@ 
    * tmp-rollback              2:db815d6d32e6
      x  y                      2:db815d6d32e6
   $ hg bookmark -d tmp-rollback
+  test-hook-bookmark: tmp-rollback:  db815d6d32e69058eadefc8cffbad37675707975 -> 
 
 activate bookmark on working dir parent without --force
 
   $ hg bookmark --inactive Z
+  test-hook-bookmark: Z:  db815d6d32e69058eadefc8cffbad37675707975 -> db815d6d32e69058eadefc8cffbad37675707975
   $ hg bookmark Z
+  test-hook-bookmark: Z:  db815d6d32e69058eadefc8cffbad37675707975 -> db815d6d32e69058eadefc8cffbad37675707975
 
 test clone
 
   $ hg bookmark -r 2 -i @
+  test-hook-bookmark: @:   -> db815d6d32e69058eadefc8cffbad37675707975
   $ hg bookmark -r 2 -i a@
+  test-hook-bookmark: a@:   -> db815d6d32e69058eadefc8cffbad37675707975
   $ hg bookmarks
      @                         2:db815d6d32e6
      X2                        1:925d80f479bb
@@ -563,10 +607,13 @@ 
 delete multiple bookmarks at once
 
   $ hg bookmark -d @ a@
+  test-hook-bookmark: @:  db815d6d32e69058eadefc8cffbad37675707975 -> 
+  test-hook-bookmark: a@:  db815d6d32e69058eadefc8cffbad37675707975 -> 
 
 test clone with a bookmark named "default" (issue3677)
 
   $ hg bookmark -r 1 -f -i default
+  test-hook-bookmark: default:   -> 925d80f479bb026b0fb3deb27503780b13f74123
   $ hg clone . cloned-bookmark-default
   updating to branch default
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -579,6 +626,7 @@ 
   $ hg -R cloned-bookmark-default parents -q
   2:db815d6d32e6
   $ hg bookmark -d default
+  test-hook-bookmark: default:  925d80f479bb026b0fb3deb27503780b13f74123 -> 
 
 test clone with a specific revision
 
@@ -647,6 +695,7 @@ 
   $ hg update
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   updating bookmark Z
+  test-hook-bookmark: Z:  db815d6d32e69058eadefc8cffbad37675707975 -> 125c9a1d6df6b1884c2b7a687a433c47c2907642
   $ hg bookmarks
      X2                        1:925d80f479bb
      Y                         2:db815d6d32e6
@@ -657,6 +706,7 @@ 
 
   $ hg bookmark -r3 Y
   moving bookmark 'Y' forward from db815d6d32e6
+  test-hook-bookmark: Y:  db815d6d32e69058eadefc8cffbad37675707975 -> 125c9a1d6df6b1884c2b7a687a433c47c2907642
   $ cp -R ../cloned-bookmarks-update ../cloned-bookmarks-manual-update
   $ cp -R ../cloned-bookmarks-update ../cloned-bookmarks-manual-update-with-divergence
 
@@ -784,12 +834,15 @@ 
      summary:     0
   
   $ hg book should-end-on-two
+  test-hook-bookmark: should-end-on-two:   -> 125c9a1d6df6b1884c2b7a687a433c47c2907642
   $ hg co --clean 4
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
   (leaving bookmark should-end-on-two)
   $ hg book four
+  test-hook-bookmark: four:   -> 9ba5f110a0b3ee8a43b825cad0a7632d7ee68485
   $ hg --config extensions.mq= strip 3
   saved backup bundle to * (glob)
+  test-hook-bookmark: should-end-on-two:  125c9a1d6df6b1884c2b7a687a433c47c2907642 -> db815d6d32e69058eadefc8cffbad37675707975
 should-end-on-two should end up pointing to revision 2, as that's the
 tipmost surviving ancestor of the stripped revision.
   $ hg log --graph
@@ -845,9 +898,13 @@ 
 test clearing divergent bookmarks of linear ancestors
 
   $ hg bookmark Z -r 0
+  test-hook-bookmark: Z:   -> f7b1eb17ad24730a1651fccd46c43826d1bbc2ac
   $ hg bookmark Z@1 -r 1
+  test-hook-bookmark: Z@1:   -> 925d80f479bb026b0fb3deb27503780b13f74123
   $ hg bookmark Z@2 -r 2
+  test-hook-bookmark: Z@2:   -> db815d6d32e69058eadefc8cffbad37675707975
   $ hg bookmark Z@3 -r 3
+  test-hook-bookmark: Z@3:   -> 9ba5f110a0b3ee8a43b825cad0a7632d7ee68485
   $ hg book
      Z                         0:f7b1eb17ad24
      Z@1                       1:925d80f479bb
@@ -857,6 +914,9 @@ 
      should-end-on-two         2:db815d6d32e6
   $ hg bookmark Z
   moving bookmark 'Z' forward from f7b1eb17ad24
+  test-hook-bookmark: Z:  f7b1eb17ad24730a1651fccd46c43826d1bbc2ac -> 9ba5f110a0b3ee8a43b825cad0a7632d7ee68485
+  test-hook-bookmark: Z@2:  db815d6d32e69058eadefc8cffbad37675707975 -> 
+  test-hook-bookmark: Z@3:  9ba5f110a0b3ee8a43b825cad0a7632d7ee68485 -> 
   $ hg book
    * Z                         3:9ba5f110a0b3
      Z@1                       1:925d80f479bb
@@ -866,10 +926,16 @@ 
 test clearing only a single divergent bookmark across branches
 
   $ hg book foo -r 1
+  test-hook-bookmark: foo:   -> 925d80f479bb026b0fb3deb27503780b13f74123
   $ hg book foo@1 -r 0
+  test-hook-bookmark: foo@1:   -> f7b1eb17ad24730a1651fccd46c43826d1bbc2ac
   $ hg book foo@2 -r 2
+  test-hook-bookmark: foo@2:   -> db815d6d32e69058eadefc8cffbad37675707975
   $ hg book foo@3 -r 3
+  test-hook-bookmark: foo@3:   -> 9ba5f110a0b3ee8a43b825cad0a7632d7ee68485
   $ hg book foo -r foo@3
+  test-hook-bookmark: foo:  925d80f479bb026b0fb3deb27503780b13f74123 -> 9ba5f110a0b3ee8a43b825cad0a7632d7ee68485
+  test-hook-bookmark: foo@3:  9ba5f110a0b3ee8a43b825cad0a7632d7ee68485 -> 
   $ hg book
    * Z                         3:9ba5f110a0b3
      Z@1                       1:925d80f479bb
@@ -886,6 +952,10 @@ 
 
   $ hg pull -q ../cloned-bookmarks-update
   divergent bookmark Z stored as Z@2
+  test-hook-bookmark: X2:   -> 925d80f479bb026b0fb3deb27503780b13f74123
+  test-hook-bookmark: Y:   -> 125c9a1d6df6b1884c2b7a687a433c47c2907642
+  test-hook-bookmark: Z@2:   -> 125c9a1d6df6b1884c2b7a687a433c47c2907642
+  test-hook-bookmark: x  y:   -> db815d6d32e69058eadefc8cffbad37675707975
 
 (pulling revision on another named branch with --update updates
 neither the working directory nor current active bookmark: "no-op"
@@ -893,6 +963,7 @@ 
 
   $ echo yy >> y
   $ hg commit -m yy
+  test-hook-bookmark: Z:  9ba5f110a0b3ee8a43b825cad0a7632d7ee68485 -> 5fb12f0f2d51dc5832daff31bae368b7d65fa329
 
   $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
    * Y                         3:125c9a1d6df6