mercurial/bundlerepo.py
changeset 50197 c493cb859158
parent 50196 2a7e8471782c
child 50198 a6a8946d5173
equal deleted inserted replaced
50196:2a7e8471782c 50197:c493cb859158
   316             # because iterparts() will seek to end of payload after the
   316             # because iterparts() will seek to end of payload after the
   317             # generator returns control to iterparts().
   317             # generator returns control to iterparts().
   318             cgpart.seek(0, os.SEEK_SET)
   318             cgpart.seek(0, os.SEEK_SET)
   319 
   319 
   320         elif isinstance(bundle, changegroup.cg1unpacker):
   320         elif isinstance(bundle, changegroup.cg1unpacker):
   321             if bundle.compressed():
   321             self._handle_bundle1(bundle, bundlepath)
   322                 f = self._writetempbundle(
       
   323                     bundle.read, b'.hg10un', header=b'HG10UN'
       
   324                 )
       
   325                 bundle = exchange.readbundle(self.ui, f, bundlepath, self.vfs)
       
   326 
       
   327             self._bundlefile = bundle
       
   328             self._cgunpacker = bundle
       
   329         else:
   322         else:
   330             raise error.Abort(
   323             raise error.Abort(
   331                 _(b'bundle type %s cannot be read') % type(bundle)
   324                 _(b'bundle type %s cannot be read') % type(bundle)
   332             )
   325             )
   333 
   326 
   339             self,
   332             self,
   340             None,
   333             None,
   341             phases.draft,
   334             phases.draft,
   342             [ctx.node() for ctx in self[self.firstnewrev :]],
   335             [ctx.node() for ctx in self[self.firstnewrev :]],
   343         )
   336         )
       
   337 
       
   338     def _handle_bundle1(self, bundle, bundlepath):
       
   339         if bundle.compressed():
       
   340             f = self._writetempbundle(bundle.read, b'.hg10un', header=b'HG10UN')
       
   341             bundle = exchange.readbundle(self.ui, f, bundlepath, self.vfs)
       
   342 
       
   343         self._bundlefile = bundle
       
   344         self._cgunpacker = bundle
   344 
   345 
   345     def _handle_bundle2_cg_part(self, bundle, part):
   346     def _handle_bundle2_cg_part(self, bundle, part):
   346         assert part.type == b'changegroup'
   347         assert part.type == b'changegroup'
   347         cgstream = part
   348         cgstream = part
   348         version = part.params.get(b'version', b'01')
   349         version = part.params.get(b'version', b'01')