[PATCH 7 of 8 V5] exchange: use `bookmarks` bundle2 part

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Sep 16 11:53:08 EDT 2016



On 09/16/2016 01:10 PM, Stanislau Hlebik wrote:
> # HG changeset patch
> # User Stanislau Hlebik <stash at fb.com>
> # Date 1473954485 25200
> #      Thu Sep 15 08:48:05 2016 -0700
> # Node ID 837f2f1650ebf323b46924040f180fc966e80fbf
> # Parent  4ace3cd7d2d2e1d63f0811034467e7b7e9719861
> exchange: use `bookmarks` bundle2 part

exchange here is too vague, are we talking about push or pull ?

> Apply changes from `bookmarks` part.
> Initial idea was to add a special mode to the bookmarks part handler that will
> apply bookmark changes differently (create divergent bookmarks etc).
> But it would've required significant code changes, so I decided to stick
> with old approach.

Having the part handler able to handle this will be very useful for 
on-disk bundle. Can you elaborate on the difficulties you face to have 
this handled on the handler side?

> diff --git a/mercurial/exchange.py b/mercurial/exchange.py
> --- a/mercurial/exchange.py
> +++ b/mercurial/exchange.py
> @@ -1370,9 +1370,13 @@
>      kwargs['cg'] = pullop.fetch
>      if 'listkeys' in pullop.remotebundle2caps:
>          kwargs['listkeys'] = ['phases']
> -        if pullop.remotebookmarks is None:
> -            # make sure to always includes bookmark data when migrating
> -            # `hg incoming --bundle` to using this function.
> +
> +    if pullop.remotebookmarks is None:
> +        # make sure to always includes bookmark data when migrating
> +        # `hg incoming --bundle` to using this function.
> +        if 'bookmarks' in pullop.remotebundle2caps:
> +            kwargs['bookmarks'] = True
> +        elif 'listkeys' in pullop.remotebundle2caps:
>              kwargs['listkeys'].append('bookmarks')
>
>      # If this is a full pull / clone and the server supports the clone bundles
> @@ -1414,6 +1418,10 @@
>              _pullapplyphases(pullop, value)
>
>      # processing bookmark update
> +    for remotebookmarks in op.records['bookmarks']:
> +        pullop.remotebookmarks = remotebookmarks
> +
> +    # processing bookmark update
>      for namespace, value in op.records['listkeys']:
>          if namespace == 'bookmarks':
>              pullop.remotebookmarks = value
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list