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, |