mercurial/exchange.py
changeset 35267 cb4dcd7fabe7
parent 35264 a1e70c1dbec0
child 35268 44b8b5ad30eb
--- a/mercurial/exchange.py	Tue Oct 17 15:26:16 2017 +0200
+++ b/mercurial/exchange.py	Tue Oct 17 15:27:17 2017 +0200
@@ -1755,6 +1755,19 @@
         if 'treemanifest' in repo.requirements:
             part.addparam('treemanifest', '1')
 
+@getbundle2partsgenerator('bookmarks')
+def _getbundlebookmarkpart(bundler, repo, source, bundlecaps=None,
+                              b2caps=None, **kwargs):
+    """add a bookmark part to the requested bundle"""
+    if not kwargs.get('bookmarks', False):
+        return
+    if 'bookmarks' not in b2caps:
+        raise ValueError(_('no common bookmarks exchange method'))
+    books  = bookmod.listbinbookmarks(repo)
+    data = bookmod.binaryencode(books)
+    if data:
+        bundler.newpart('bookmarks', data=data)
+
 @getbundle2partsgenerator('listkeys')
 def _getbundlelistkeysparts(bundler, repo, source, bundlecaps=None,
                             b2caps=None, **kwargs):