Mercurial > hg-stable
changeset 35276:cb4dcd7fabe7
getbundle: add support for 'bookmarks' boolean argument
This new argument requests a 'bookmarks' part from the server. It is meant to
be used instead of the "listkeys" request.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Tue, 17 Oct 2017 15:27:17 +0200 |
parents | 496154e41968 |
children | 44b8b5ad30eb |
files | mercurial/exchange.py mercurial/help/internals/wireprotocol.txt mercurial/wireproto.py |
diffstat | 3 files changed, 16 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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):
--- a/mercurial/help/internals/wireprotocol.txt Tue Oct 17 15:26:16 2017 +0200 +++ b/mercurial/help/internals/wireprotocol.txt Tue Oct 17 15:27:17 2017 +0200 @@ -731,6 +731,8 @@ cbattempted Boolean indicating whether the client attempted to use the *clone bundles* feature before performing this request. +bookmarks + Boolean indicating whether bookmark data is requested. phases Boolean indicating whether phases data is requested.
--- a/mercurial/wireproto.py Tue Oct 17 15:26:16 2017 +0200 +++ b/mercurial/wireproto.py Tue Oct 17 15:27:17 2017 +0200 @@ -205,6 +205,7 @@ # :scsv: list of comma-separated values return as set # :plain: string with no transformation needed. gboptsmap = {'heads': 'nodes', + 'bookmarks': 'boolean', 'common': 'nodes', 'obsmarkers': 'boolean', 'phases': 'boolean',