diff --git a/mercurial/exchange.py b/mercurial/exchange.py index 08cc94dd3d3ceea60f503dab9e4b9645650ba7f9_bWVyY3VyaWFsL2V4Y2hhbmdlLnB5..ba15580e53d5c9b858280490d975f9f7f8cdd162_bWVyY3VyaWFsL2V4Y2hhbmdlLnB5 100644 --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -1727,6 +1727,7 @@ Could be a bundle HG10 or a bundle HG20 depending on bundlecaps passed. - Returns an iterator over raw chunks (of varying sizes). + Returns a 2-tuple of a dict with metadata about the generated bundle + and an iterator over raw chunks (of varying sizes). """ kwargs = pycompat.byteskwargs(kwargs) @@ -1731,5 +1732,6 @@ """ kwargs = pycompat.byteskwargs(kwargs) + info = {} usebundle2 = bundle2requested(bundlecaps) # bundle10 case if not usebundle2: @@ -1740,7 +1742,8 @@ raise ValueError(_('unsupported getbundle arguments: %s') % ', '.join(sorted(kwargs.keys()))) outgoing = _computeoutgoing(repo, heads, common) - return changegroup.makestream(repo, outgoing, '01', source, - bundlecaps=bundlecaps) + info['bundleversion'] = 1 + return info, changegroup.makestream(repo, outgoing, '01', source, + bundlecaps=bundlecaps) # bundle20 case @@ -1745,5 +1748,6 @@ # bundle20 case + info['bundleversion'] = 2 b2caps = {} for bcaps in bundlecaps: if bcaps.startswith('bundle2='): @@ -1759,7 +1763,7 @@ func(bundler, repo, source, bundlecaps=bundlecaps, b2caps=b2caps, **pycompat.strkwargs(kwargs)) - return bundler.getchunks() + return info, bundler.getchunks() @getbundle2partsgenerator('stream') def _getbundlestream(bundler, repo, source, bundlecaps=None, diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py index 08cc94dd3d3ceea60f503dab9e4b9645650ba7f9_bWVyY3VyaWFsL2xvY2FscmVwby5weQ==..ba15580e53d5c9b858280490d975f9f7f8cdd162_bWVyY3VyaWFsL2xvY2FscmVwby5weQ== 100644 --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -197,7 +197,7 @@ **kwargs): chunks = exchange.getbundlechunks(self._repo, source, heads=heads, common=common, bundlecaps=bundlecaps, - **kwargs) + **kwargs)[1] cb = util.chunkbuffer(chunks) if exchange.bundle2requested(bundlecaps): diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py index 08cc94dd3d3ceea60f503dab9e4b9645650ba7f9_bWVyY3VyaWFsL3dpcmVwcm90by5weQ==..ba15580e53d5c9b858280490d975f9f7f8cdd162_bWVyY3VyaWFsL3dpcmVwcm90by5weQ== 100644 --- a/mercurial/wireproto.py +++ b/mercurial/wireproto.py @@ -877,8 +877,8 @@ _('server has pull-based clones disabled'), hint=_('remove --pull if specified or upgrade Mercurial')) - chunks = exchange.getbundlechunks(repo, 'serve', - **pycompat.strkwargs(opts)) + info, chunks = exchange.getbundlechunks(repo, 'serve', + **pycompat.strkwargs(opts)) except error.Abort as exc: # cleanly forward Abort error to the client if not exchange.bundle2requested(opts.get('bundlecaps')):