mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 09:17:30 +03:00
infinitepush: handle old changegroup format correctly server-side
Summary: `exchange.readbundle()` can return bundle2 unbundler or changegroup cg1unpacker. In case of cg1unpacker let's just read it from the stream Test Plan: arc unit Reviewers: #mercurial, quark Reviewed By: quark Subscribers: quark, mjpieters, #sourcecontrol Differential Revision: https://phabricator.intern.facebook.com/D4913313 Tasks: 15389402 Signature: t1:4913313:1492623174:72abe4d1e449ae31d78a6c98b554c0406e8a2ea2
This commit is contained in:
parent
1aed2e20f9
commit
da24919aa2
@ -471,10 +471,17 @@ def getbundlechunks(orig, repo, source, heads=None, bundlecaps=None, **kwargs):
|
||||
if not _needsrebundling(head, bundlerepo):
|
||||
with util.posixfile(bundlefile, "rb") as f:
|
||||
unbundler = exchange.readbundle(repo.ui, f, bundlefile)
|
||||
for part in unbundler.iterparts():
|
||||
if part.type == 'changegroup':
|
||||
version = part.params.get('version', '01')
|
||||
scratchbundles.append((part.read(), version))
|
||||
if isinstance(unbundler, changegroup.cg1unpacker):
|
||||
scratchbundles.append((unbundler._stream.read(),
|
||||
'01'))
|
||||
elif isinstance(unbundler, bundle2.unbundle20):
|
||||
for part in unbundler.iterparts():
|
||||
if part.type == 'changegroup':
|
||||
version = part.params.get('version', '01')
|
||||
scratchbundles.append(
|
||||
(part.read(), version))
|
||||
else:
|
||||
raise error.Abort('unknown bundle type')
|
||||
else:
|
||||
outputbundleraw = _rebundle(bundlerepo, bundleroots,
|
||||
head, version='02')
|
||||
|
Loading…
Reference in New Issue
Block a user