Mercurial > hg-stable
changeset 21657:0ff44e06275d
getbundle: support of listkeys argument when bundle2 is used
A new ``listkeys`` is supported by getbundle. It is a list of namespaces whose
content should be included in the bundle.
An appropriate entry has been added to the wireproto map of getbundle arguments
and a new bundle2 capability is advertised.
There are still no codes that request such parts in core mercurial.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Tue, 27 May 2014 15:43:09 -0700 |
parents | 36200dc6b3bd |
children | 0696ca0a685b |
files | mercurial/exchange.py mercurial/localrepo.py mercurial/wireproto.py |
diffstat | 3 files changed, 11 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/exchange.py Thu May 29 14:59:22 2014 -0700 +++ b/mercurial/exchange.py Tue May 27 15:43:09 2014 -0700 @@ -9,7 +9,7 @@ from node import hex, nullid import errno, urllib import util, scmutil, changegroup, base85, error -import discovery, phases, obsolete, bookmarks, bundle2 +import discovery, phases, obsolete, bookmarks, bundle2, pushkey def readbundle(ui, fh, fname, vfs=None): header = changegroup.readexactly(fh, 4) @@ -678,6 +678,12 @@ bundler = bundle2.bundle20(repo.ui, b2caps) if cg: bundler.newpart('b2x:changegroup', data=cg.getchunks()) + listkeys = kwargs.get('listkeys', ()) + for namespace in listkeys: + part = bundler.newpart('b2x:listkeys') + part.addparam('namespace', namespace) + keys = repo.listkeys(namespace).items() + part.data = pushkey.encodekeys(keys) _getbundleextrapart(bundler, repo, source, heads=heads, common=common, bundlecaps=bundlecaps, **kwargs) return util.chunkbuffer(bundler.getchunks())
--- a/mercurial/localrepo.py Thu May 29 14:59:22 2014 -0700 +++ b/mercurial/localrepo.py Tue May 27 15:43:09 2014 -0700 @@ -180,7 +180,8 @@ requirements = ['revlogv1'] filtername = None - bundle2caps = {'HG2X': ()} + bundle2caps = {'HG2X': (), + 'b2x:listkeys': ()} # a list of (ui, featureset) functions. # only functions defined in module of enabled extensions are invoked
--- a/mercurial/wireproto.py Thu May 29 14:59:22 2014 -0700 +++ b/mercurial/wireproto.py Tue May 27 15:43:09 2014 -0700 @@ -202,7 +202,8 @@ # :plain: string with no transformation needed. gboptsmap = {'heads': 'nodes', 'common': 'nodes', - 'bundlecaps': 'csv'} + 'bundlecaps': 'csv', + 'listkeys': 'csv'} # client side