[PATCH 7 of 9 V6] exchange: getbundle `bookmarks` part generator
Stanislau Hlebik
stash at fb.com
Tue Oct 11 16:25:49 UTC 2016
# HG changeset patch
# User Stanislau Hlebik <stash at fb.com>
# Date 1476195835 25200
# Tue Oct 11 07:23:55 2016 -0700
# Node ID 48e5db9c751c1eca19019bbc24de43f7cb3368e7
# Parent b9e71247c1b68ce1fac7dd69cf26d106f88f9372
exchange: getbundle `bookmarks` part generator
This generator will be used during pull operation.
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -1672,6 +1672,21 @@
if chunks:
bundler.newpart('hgtagsfnodes', data=''.join(chunks))
+ at getbundle2partsgenerator('bookmarks')
+def _getbundlebookmarkspart(bundler, repo, source, bundlecaps=None,
+ b2caps=None, heads=None, common=None,
+ **kwargs):
+ if not kwargs.get('bookmarks'):
+ return
+ if 'bookmarks' not in b2caps:
+ raise ValueError(
+ _('bookmarks are requested but client is not capable '
+ 'of receiving it'))
+
+ bookmarks = _getbookmarks(repo, **kwargs)
+ encodedbookmarks = bookmod.encodebookmarks(bookmarks)
+ bundler.newpart('bookmarks', data=encodedbookmarks)
+
def _getbookmarks(repo, **kwargs):
"""Returns list of bookmarks.
diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -220,7 +220,8 @@
'bundlecaps': 'scsv',
'listkeys': 'csv',
'cg': 'boolean',
- 'cbattempted': 'boolean'}
+ 'cbattempted': 'boolean',
+ 'bookmarks': 'boolean'}
# client side
More information about the Mercurial-devel
mailing list