286 |
286 |
287 if isinstance(bundle, bundle2.unbundle20): |
287 if isinstance(bundle, bundle2.unbundle20): |
288 self._bundlefile = bundle |
288 self._bundlefile = bundle |
289 self._cgunpacker = None |
289 self._cgunpacker = None |
290 |
290 |
291 hadchangegroup = False |
291 cgpart = None |
292 for part in bundle.iterparts(): |
292 for part in bundle.iterparts(): |
293 if part.type == 'changegroup': |
293 if part.type == 'changegroup': |
294 if hadchangegroup: |
294 if cgpart: |
295 raise NotImplementedError("can't process " |
295 raise NotImplementedError("can't process " |
296 "multiple changegroups") |
296 "multiple changegroups") |
297 hadchangegroup = True |
297 cgpart = part |
298 |
298 |
299 self._handlebundle2part(bundle, part) |
299 self._handlebundle2part(bundle, part) |
300 |
300 |
301 if not hadchangegroup: |
301 if not cgpart: |
302 raise error.Abort(_("No changegroups found")) |
302 raise error.Abort(_("No changegroups found")) |
|
303 |
|
304 # This is required to placate a later consumer, which expects |
|
305 # the payload offset to be at the beginning of the changegroup. |
|
306 # We need to do this after the iterparts() generator advances |
|
307 # because iterparts() will seek to end of payload after the |
|
308 # generator returns control to iterparts(). |
|
309 cgpart.seek(0, os.SEEK_SET) |
|
310 |
303 elif isinstance(bundle, changegroup.cg1unpacker): |
311 elif isinstance(bundle, changegroup.cg1unpacker): |
304 if bundle.compressed(): |
312 if bundle.compressed(): |
305 f = self._writetempbundle(bundle.read, '.hg10un', |
313 f = self._writetempbundle(bundle.read, '.hg10un', |
306 header='HG10UN') |
314 header='HG10UN') |
307 bundle = exchange.readbundle(ui, f, bundlepath, self.vfs) |
315 bundle = exchange.readbundle(ui, f, bundlepath, self.vfs) |