##// END OF EJS Templates
bundle2: only seek to beginning of part in bundlerepo...
Gregory Szorc -
r35112:2b72bc88 default
parent child Browse files
Show More
@@ -859,9 +859,7 b' class unbundle20(unpackermixin):'
859 859 # Ensure part is fully consumed so we can start reading the next
860 860 # part.
861 861 part.consume()
862 # But then seek back to the beginning so the code consuming this
863 # generator has a part that starts at 0.
864 part.seek(0, os.SEEK_SET)
862
865 863 headerblock = self._readpartheader()
866 864 indebug(self.ui, 'end of bundle2 stream')
867 865
@@ -288,18 +288,26 b' class bundlerepository(localrepo.localre'
288 288 self._bundlefile = bundle
289 289 self._cgunpacker = None
290 290
291 hadchangegroup = False
291 cgpart = None
292 292 for part in bundle.iterparts():
293 293 if part.type == 'changegroup':
294 if hadchangegroup:
294 if cgpart:
295 295 raise NotImplementedError("can't process "
296 296 "multiple changegroups")
297 hadchangegroup = True
297 cgpart = part
298 298
299 299 self._handlebundle2part(bundle, part)
300 300
301 if not hadchangegroup:
301 if not cgpart:
302 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 311 elif isinstance(bundle, changegroup.cg1unpacker):
304 312 if bundle.compressed():
305 313 f = self._writetempbundle(bundle.read, '.hg10un',
General Comments 0
You need to be logged in to leave comments. Login now