[PATCH 5 of 8 V7] exchange: getbundle `bookmarks` part generator
Stanislau Hlebik
stash at fb.com
Wed Nov 2 10:06:47 EDT 2016
# HG changeset patch
# User Stanislau Hlebik <stash at fb.com>
# Date 1478016027 25200
# Tue Nov 01 09:00:27 2016 -0700
# Branch stable
# Node ID 12466c729bb6783fbef11a6e148c648809b4f592
# Parent 2f89680108366512c1a6345abec5cebdb85170ac
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
@@ -1666,6 +1666,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
@@ -228,7 +228,9 @@
'bundlecaps': 'scsv',
'listkeys': 'csv',
'cg': 'boolean',
- 'cbattempted': 'boolean'}
+ 'cbattempted': 'boolean',
+ 'bookmarks': 'boolean',
+ }
# client side
More information about the Mercurial-devel
mailing list