[PATCH 3 of 7 V4] bundle2: add `bookmarks` part handler

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Sep 6 08:58:20 EDT 2016



On 09/05/2016 12:46 AM, Stanislau Hlebik wrote:
> # HG changeset patch
> # User Stanislau Hlebik <stash at fb.com>
> # Date 1473012054 25200
> #      Sun Sep 04 11:00:54 2016 -0700
> # Node ID 70a86f2bd0e7684eda82310dc9024b346f59dbf6
> # Parent  f3bc1662dbce19de1f51c4da519238dbe98c1c95
> bundle2: add `bookmarks` part handler
>
> diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
> --- a/mercurial/bundle2.py
> +++ b/mercurial/bundle2.py
> @@ -156,6 +156,7 @@
>  from .i18n import _
>  from . import (
>      changegroup,
> +    encoding,
>      error,
>      obsolete,
>      pushkey,
> @@ -1613,3 +1614,12 @@
>
>      cache.write()
>      op.ui.debug('applied %i hgtags fnodes cache entries\n' % count)
> +
> + at parthandler('bookmarks')
> +def handlebookmarks(op, inpart):
> +    dec = encoding.tolocal
> +    bookmarks = {}
> +    for bookmarknode in inpart.read().splitlines():
> +        book, node = bookmarknode.rsplit(' ', 1)
> +        bookmarks[dec(book)] = dec(node)

The bookmark are encoded on the other side, should we decode them here 
or is it handled somewhere else.

> +    op.records.add('bookmarks', bookmarks)

Now that we have a specific part for bookmark we might be able to do 
something more in the part handler itself (keeping the record seems 
useful for the purpose of communication with other bits)

Cheers,

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list