D1925: exchange: return bundle info from getbundlechunks() (API)
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Mon Jan 22 20:08:23 UTC 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGba15580e53d5: exchange: return bundle info from getbundlechunks() (API) (authored by indygreg, committed by ).
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D1925?vs=4966&id=4983
REVISION DETAIL
https://phab.mercurial-scm.org/D1925
AFFECTED FILES
mercurial/exchange.py
mercurial/localrepo.py
mercurial/wireproto.py
CHANGE DETAILS
diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- 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')):
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- 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/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -1727,9 +1727,11 @@
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)
+ info = {}
usebundle2 = bundle2requested(bundlecaps)
# bundle10 case
if not usebundle2:
@@ -1740,10 +1742,12 @@
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
+ 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,
To: indygreg, #hg-reviewers, durin42
Cc: durin42, lothiraldan, mercurial-devel
More information about the Mercurial-devel
mailing list