Mercurial > public > mercurial-scm > hg
comparison mercurial/exchange.py @ 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 |
comparison
equal
deleted
inserted
replaced
21656:36200dc6b3bd | 21657:0ff44e06275d |
---|---|
7 | 7 |
8 from i18n import _ | 8 from i18n import _ |
9 from node import hex, nullid | 9 from node import hex, nullid |
10 import errno, urllib | 10 import errno, urllib |
11 import util, scmutil, changegroup, base85, error | 11 import util, scmutil, changegroup, base85, error |
12 import discovery, phases, obsolete, bookmarks, bundle2 | 12 import discovery, phases, obsolete, bookmarks, bundle2, pushkey |
13 | 13 |
14 def readbundle(ui, fh, fname, vfs=None): | 14 def readbundle(ui, fh, fname, vfs=None): |
15 header = changegroup.readexactly(fh, 4) | 15 header = changegroup.readexactly(fh, 4) |
16 | 16 |
17 alg = None | 17 alg = None |
676 blob = urllib.unquote(bcaps[len('bundle2='):]) | 676 blob = urllib.unquote(bcaps[len('bundle2='):]) |
677 b2caps.update(bundle2.decodecaps(blob)) | 677 b2caps.update(bundle2.decodecaps(blob)) |
678 bundler = bundle2.bundle20(repo.ui, b2caps) | 678 bundler = bundle2.bundle20(repo.ui, b2caps) |
679 if cg: | 679 if cg: |
680 bundler.newpart('b2x:changegroup', data=cg.getchunks()) | 680 bundler.newpart('b2x:changegroup', data=cg.getchunks()) |
681 listkeys = kwargs.get('listkeys', ()) | |
682 for namespace in listkeys: | |
683 part = bundler.newpart('b2x:listkeys') | |
684 part.addparam('namespace', namespace) | |
685 keys = repo.listkeys(namespace).items() | |
686 part.data = pushkey.encodekeys(keys) | |
681 _getbundleextrapart(bundler, repo, source, heads=heads, common=common, | 687 _getbundleextrapart(bundler, repo, source, heads=heads, common=common, |
682 bundlecaps=bundlecaps, **kwargs) | 688 bundlecaps=bundlecaps, **kwargs) |
683 return util.chunkbuffer(bundler.getchunks()) | 689 return util.chunkbuffer(bundler.getchunks()) |
684 | 690 |
685 def _getbundleextrapart(bundler, repo, source, heads=None, common=None, | 691 def _getbundleextrapart(bundler, repo, source, heads=None, common=None, |