Mercurial > public > mercurial-scm > hg
diff tests/test-bookmarks-pushpull.t @ 34708:ee5f0d047b41
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.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Tue, 10 Oct 2017 17:53:42 +0200 |
parents | eb586ed5d8ce |
children | 1644623ab096 |
line wrap: on
line diff
--- a/tests/test-bookmarks-pushpull.t Fri Oct 13 15:58:54 2017 -0400 +++ b/tests/test-bookmarks-pushpull.t Tue Oct 10 17:53:42 2017 +0200 @@ -9,6 +9,8 @@ > stabilization=createmarkers,exchange > EOF + $ TESTHOOK='hooks.txnclose-bookmark.test=echo "test-hook-bookmark: $HG_BOOKMARK: $HG_OLDNODE -> $HG_NODE"' + initialize $ hg init a @@ -30,7 +32,7 @@ $ hg book Y $ hg book * Y -1:000000000000 - $ hg pull ../a + $ hg pull ../a --config "$TESTHOOK" pulling from ../a requesting all changes adding changesets @@ -41,6 +43,9 @@ updating bookmark Y adding remote bookmark Z new changesets 4e3505fd9583 + 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 @@ -94,10 +99,11 @@ delete a remote bookmark $ hg book -d W - $ hg push -B W ../a + $ hg push -B W ../a --config "$TESTHOOK" pushing to ../a searching for changes no changes found + test-hook-bookmark: W: 0000000000000000000000000000000000000000 -> deleting remote bookmark W [1] @@ -165,7 +171,7 @@ Z 1:0d2164f0ce0d $ cd ../b - $ hg up + $ hg up --config 1 files updated, 0 files merged, 0 files removed, 0 files unresolved updating bookmark foobar $ echo c2 > f2 @@ -181,7 +187,7 @@ foo -1:000000000000 * foobar 1:9b140be10808 - $ hg pull --config paths.foo=../a foo + $ hg pull --config paths.foo=../a foo --config "$TESTHOOK" pulling from $TESTTMP/a (glob) searching for changes adding changesets @@ -192,6 +198,9 @@ divergent bookmark X stored as X@foo updating bookmark Z new changesets 0d2164f0ce0d + 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 @@ -254,11 +263,13 @@ $ hg update -r X 0 files updated, 0 files merged, 0 files removed, 0 files unresolved (activating bookmark X) - $ hg pull --config paths.foo=../a foo -B . + $ hg pull --config paths.foo=../a foo -B . --config "$TESTHOOK" pulling from $TESTTMP/a (glob) 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: @@ -283,13 +294,14 @@ $ hg ci -Am3 adding f2 created new head - $ hg push ../a + $ hg push ../a --config "$TESTHOOK" pushing to ../a searching for changes adding changesets 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 @@ -314,7 +326,11 @@ > echo committed in pull-race > EOF - $ hg clone -q http://localhost:$HGPORT/ pull-race2 + $ hg clone -q http://localhost:$HGPORT/ pull-race2 --config "$TESTHOOK" + 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