comparison mercurial/bundlerepo.py @ 50198:a6a8946d5173

bundlerepo: move most attribute declaration earlier in __init__ The expected attribute are clearer this way. The bundle handling code is responsible for setting most of it.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 23 Feb 2023 19:06:24 +0100
parents c493cb859158
children 21f876895dfe
comparison
equal deleted inserted replaced
50197:c493cb859158 50198:a6a8946d5173
287 self._tempparent = tempparent 287 self._tempparent = tempparent
288 self._url = url 288 self._url = url
289 289
290 self.ui.setconfig(b'phases', b'publish', False, b'bundlerepo') 290 self.ui.setconfig(b'phases', b'publish', False, b'bundlerepo')
291 291
292 # dict with the mapping 'filename' -> position in the changegroup.
293 self._cgfilespos = {}
294 self._bundlefile = None
295 self._cgunpacker = None
292 self.tempfile = None 296 self.tempfile = None
293 f = util.posixfile(bundlepath, b"rb") 297 f = util.posixfile(bundlepath, b"rb")
294 bundle = exchange.readbundle(self.ui, f, bundlepath) 298 bundle = exchange.readbundle(self.ui, f, bundlepath)
295 299
296 if isinstance(bundle, bundle2.unbundle20): 300 if isinstance(bundle, bundle2.unbundle20):
297 self._bundlefile = bundle 301 self._bundlefile = bundle
298 self._cgunpacker = None
299 302
300 cgpart = None 303 cgpart = None
301 for part in bundle.iterparts(seekable=True): 304 for part in bundle.iterparts(seekable=True):
302 if part.type == b'changegroup': 305 if part.type == b'changegroup':
303 if cgpart: 306 if cgpart:
321 self._handle_bundle1(bundle, bundlepath) 324 self._handle_bundle1(bundle, bundlepath)
322 else: 325 else:
323 raise error.Abort( 326 raise error.Abort(
324 _(b'bundle type %s cannot be read') % type(bundle) 327 _(b'bundle type %s cannot be read') % type(bundle)
325 ) 328 )
326
327 # dict with the mapping 'filename' -> position in the changegroup.
328 self._cgfilespos = {}
329 329
330 self.firstnewrev = self.changelog.repotiprev + 1 330 self.firstnewrev = self.changelog.repotiprev + 1
331 phases.retractboundary( 331 phases.retractboundary(
332 self, 332 self,
333 None, 333 None,