[PATCH 4 of 7 V4] exchange: add `pushbookmarks` part generator
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Tue Sep 6 08:59:17 EDT 2016
On 09/05/2016 12:46 AM, Stanislau Hlebik wrote:
> # HG changeset patch
> # User Stanislau Hlebik <stash at fb.com>
> # Date 1473022588 25200
> # Sun Sep 04 13:56:28 2016 -0700
> # Node ID db526b94eeb678879c2faceb40c64aebbe1054af
> # Parent 70a86f2bd0e7684eda82310dc9024b346f59dbf6
> exchange: add `pushbookmarks` part generator
>
> diff --git a/mercurial/exchange.py b/mercurial/exchange.py
> --- a/mercurial/exchange.py
> +++ b/mercurial/exchange.py
> @@ -806,6 +806,50 @@
> markers = sorted(pushop.outobsmarkers)
> buildobsmarkerspart(bundler, markers)
>
> + at b2partsgenerator('pushbookmarks')
> +def _pushb2bookmarksnew(pushop, bundler):
> + if 'bookmarks' in pushop.stepsdone:
> + return
> + b2caps = bundle2.bundle2caps(pushop.remote)
> + if 'pushbookmarks' not in b2caps:
> + return
> + pushop.stepsdone.add('bookmarks')
> + if not pushop.outbookmarks:
> + return
> + booktoaction = {}
> + bookmarksdata = []
> + enc = encoding.fromlocal
> + for book, old, new in pushop.outbookmarks:
> + action = 'update'
> + if not old:
> + action = 'export'
> + elif not new:
> + action = 'delete'
> + booktoaction[book] = action
> + bookmarksdata.append('%s %s %s' % (enc(book), enc(old), enc(new)))
> + part = bundler.newpart('pushbookmarks', data='\n'.join(bookmarksdata))
This part seems common with your the generation during pull, we should
probably build a "part-building-function" and use that in both place.
--
Pierre-Yves David
More information about the Mercurial-devel
mailing list