Mercurial > public > mercurial-scm > hg
comparison mercurial/bundlerepo.py @ 50196:2a7e8471782c
bundlerepo: expliclty handing cg part from bundle2
We will handle other types of parts soon (phase-heads) so we need some cleanup
first.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 23 Feb 2023 19:02:01 +0100 |
parents | 562f7da122b5 |
children | c493cb859158 |
comparison
equal
deleted
inserted
replaced
50195:11e6eee4b063 | 50196:2a7e8471782c |
---|---|
303 if cgpart: | 303 if cgpart: |
304 raise NotImplementedError( | 304 raise NotImplementedError( |
305 b"can't process multiple changegroups" | 305 b"can't process multiple changegroups" |
306 ) | 306 ) |
307 cgpart = part | 307 cgpart = part |
308 | 308 self._handle_bundle2_cg_part(bundle, part) |
309 self._handlebundle2part(bundle, part) | |
310 | 309 |
311 if not cgpart: | 310 if not cgpart: |
312 raise error.Abort(_(b"No changegroups found")) | 311 raise error.Abort(_(b"No changegroups found")) |
313 | 312 |
314 # This is required to placate a later consumer, which expects | 313 # This is required to placate a later consumer, which expects |
341 None, | 340 None, |
342 phases.draft, | 341 phases.draft, |
343 [ctx.node() for ctx in self[self.firstnewrev :]], | 342 [ctx.node() for ctx in self[self.firstnewrev :]], |
344 ) | 343 ) |
345 | 344 |
346 def _handlebundle2part(self, bundle, part): | 345 def _handle_bundle2_cg_part(self, bundle, part): |
347 if part.type != b'changegroup': | 346 assert part.type == b'changegroup' |
348 return | |
349 | |
350 cgstream = part | 347 cgstream = part |
351 version = part.params.get(b'version', b'01') | 348 version = part.params.get(b'version', b'01') |
352 legalcgvers = changegroup.supportedincomingversions(self) | 349 legalcgvers = changegroup.supportedincomingversions(self) |
353 if version not in legalcgvers: | 350 if version not in legalcgvers: |
354 msg = _(b'Unsupported changegroup version: %s') | 351 msg = _(b'Unsupported changegroup version: %s') |