[PATCH 4 of 4] bookmarks: inform transaction-related hook than some bookmarks were moved

Augie Fackler raf at durin42.com
Tue Oct 14 14:51:14 CDT 2014


On Mon, Oct 13, 2014 at 03:19:38PM -0700, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at fb.com>
> # Date 1413127771 25200
> #      Sun Oct 12 08:29:31 2014 -0700
> # Node ID bececd4fa93dd4c9f1f797eaed05dc2d4a7be0e7
> # Parent  417bd7513cb2b27c3cc10d53f93d1bdbbad78d04
> bookmarks: inform transaction-related hook than some bookmarks were moved

queued, thanks

>
> We do not have enough information to provide a finer data. But this is still
> useful information.
>
> diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
> --- a/mercurial/bookmarks.py
> +++ b/mercurial/bookmarks.py
> @@ -51,10 +51,11 @@ class bmstore(dict):
>          """record that bookmarks have been changed in a transaction
>
>          The transaction is then responsible for updating the file content."""
>          tr.addfilegenerator('bookmarks', ('bookmarks',), self._write,
>                              vfs=self._repo.vfs)
> +        tr.hookargs['bookmark_moved'] = '1'
>
>      def write(self):
>          '''Write bookmarks
>
>          Write the given bookmark => hash dictionary to the .hg/bookmarks file
> 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
> @@ -156,12 +156,12 @@ add extra data to test their exchange du
>
>  push
>    $ hg -R main push other --rev eea13746799a --bookmark book_eea1
>    pushing to other
>    searching for changes
> -  b2x-transactionclose hook: HG_BUNDLE2-EXP=1 HG_NEW_OBSMARKERS=1 HG_PHASES_MOVED=1 HG_SOURCE=push HG_URL=push
> -  changegroup hook: HG_BUNDLE2-EXP=1 HG_NEW_OBSMARKERS=1 HG_PHASES_MOVED=1 HG_SOURCE=bundle2 HG_URL=bundle2
> +  b2x-transactionclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2-EXP=1 HG_NEW_OBSMARKERS=1 HG_PHASES_MOVED=1 HG_SOURCE=push HG_URL=push
> +  changegroup hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2-EXP=1 HG_NEW_OBSMARKERS=1 HG_PHASES_MOVED=1 HG_SOURCE=bundle2 HG_URL=bundle2
>    remote: adding changesets
>    remote: adding manifests
>    remote: adding file changes
>    remote: added 1 changesets with 0 changes to 0 files (-1 heads)
>    remote: 1 new obsolescence markers
> @@ -189,11 +189,11 @@ pull over ssh
>    adding manifests
>    adding file changes
>    added 1 changesets with 1 changes to 1 files (+1 heads)
>    1 new obsolescence markers
>    updating bookmark book_02de
> -  changegroup hook: HG_NEW_OBSMARKERS=1 HG_PHASES_MOVED=1 HG_SOURCE=bundle2 HG_URL=bundle2
> +  changegroup hook: HG_BOOKMARK_MOVED=1 HG_NEW_OBSMARKERS=1 HG_PHASES_MOVED=1 HG_SOURCE=bundle2 HG_URL=bundle2
>    (run 'hg heads' to see heads, 'hg merge' to merge)
>    $ hg -R other debugobsolete
>    1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
>    2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
>    3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
> @@ -211,11 +211,11 @@ pull over http
>    adding manifests
>    adding file changes
>    added 1 changesets with 1 changes to 1 files (+1 heads)
>    1 new obsolescence markers
>    updating bookmark book_42cc
> -  changegroup hook: HG_NEW_OBSMARKERS=1 HG_PHASES_MOVED=1 HG_SOURCE=bundle2 HG_URL=bundle2
> +  changegroup hook: HG_BOOKMARK_MOVED=1 HG_NEW_OBSMARKERS=1 HG_PHASES_MOVED=1 HG_SOURCE=bundle2 HG_URL=bundle2
>    (run 'hg heads .' to see heads, 'hg merge' to merge)
>    $ cat main-error.log
>    $ hg -R other debugobsolete
>    1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
>    2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
> @@ -232,12 +232,12 @@ push over ssh
>    remote: adding manifests
>    remote: adding file changes
>    remote: added 1 changesets with 1 changes to 1 files
>    remote: 1 new obsolescence markers
>    updating bookmark book_5fdd
> -  remote: b2x-transactionclose hook: HG_BUNDLE2-EXP=1 HG_NEW_OBSMARKERS=1 HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1
> -  remote: changegroup hook: HG_BUNDLE2-EXP=1 HG_NEW_OBSMARKERS=1 HG_SOURCE=bundle2 HG_URL=bundle2
> +  remote: b2x-transactionclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2-EXP=1 HG_NEW_OBSMARKERS=1 HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1
> +  remote: changegroup hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2-EXP=1 HG_NEW_OBSMARKERS=1 HG_SOURCE=bundle2 HG_URL=bundle2
>    $ hg -R other log -G
>    o  6:5fddd98957c8 draft Nicolas Dumazet <nicdumz.commits at gmail.com> book_5fdd C
>    |
>    o  5:42ccdea3bb16 draft Nicolas Dumazet <nicdumz.commits at gmail.com> book_42cc B
>    |
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list