Show More
@@ -281,11 +281,11 b' class bundlerepository(localrepo.localre' | |||
|
281 | 281 | |
|
282 | 282 | self.tempfile = None |
|
283 | 283 | f = util.posixfile(bundlepath, "rb") |
|
284 | self.bundlefile = self.bundle = exchange.readbundle(ui, f, bundlepath) | |
|
284 | self._bundlefile = self._bundle = exchange.readbundle(ui, f, bundlepath) | |
|
285 | 285 | |
|
286 | if isinstance(self.bundle, bundle2.unbundle20): | |
|
286 | if isinstance(self._bundle, bundle2.unbundle20): | |
|
287 | 287 | hadchangegroup = False |
|
288 | for part in self.bundle.iterparts(): | |
|
288 | for part in self._bundle.iterparts(): | |
|
289 | 289 | if part.type == 'changegroup': |
|
290 | 290 | if hadchangegroup: |
|
291 | 291 | raise NotImplementedError("can't process " |
@@ -296,16 +296,15 b' class bundlerepository(localrepo.localre' | |||
|
296 | 296 | |
|
297 | 297 | if not hadchangegroup: |
|
298 | 298 | raise error.Abort(_("No changegroups found")) |
|
299 | elif isinstance(self.bundle, changegroup.cg1unpacker): | |
|
300 | if self.bundle.compressed(): | |
|
301 | f = self._writetempbundle(self.bundle.read, '.hg10un', | |
|
299 | elif isinstance(self._bundle, changegroup.cg1unpacker): | |
|
300 | if self._bundle.compressed(): | |
|
301 | f = self._writetempbundle(self._bundle.read, '.hg10un', | |
|
302 | 302 | header='HG10UN') |
|
303 |
self.bundlefile = self.bundle = exchange.readbundle( |
|
|
304 | bundlepath, | |
|
305 | self.vfs) | |
|
303 | self._bundlefile = self._bundle = exchange.readbundle( | |
|
304 | ui, f, bundlepath, self.vfs) | |
|
306 | 305 | else: |
|
307 | 306 | raise error.Abort(_('bundle type %s cannot be read') % |
|
308 | type(self.bundle)) | |
|
307 | type(self._bundle)) | |
|
309 | 308 | |
|
310 | 309 | # dict with the mapping 'filename' -> position in the bundle |
|
311 | 310 | self.bundlefilespos = {} |
@@ -322,11 +321,11 b' class bundlerepository(localrepo.localre' | |||
|
322 | 321 | if version not in legalcgvers: |
|
323 | 322 | msg = _('Unsupported changegroup version: %s') |
|
324 | 323 | raise error.Abort(msg % version) |
|
325 | if self.bundle.compressed(): | |
|
324 | if self._bundle.compressed(): | |
|
326 | 325 | cgstream = self._writetempbundle(part.read, |
|
327 | 326 | ".cg%sun" % version) |
|
328 | 327 | |
|
329 | self.bundle = changegroup.getunbundler(version, cgstream, 'UN') | |
|
328 | self._bundle = changegroup.getunbundler(version, cgstream, 'UN') | |
|
330 | 329 | |
|
331 | 330 | def _writetempbundle(self, readfn, suffix, header=''): |
|
332 | 331 | """Write a temporary file to disk |
@@ -352,28 +351,28 b' class bundlerepository(localrepo.localre' | |||
|
352 | 351 | @localrepo.unfilteredpropertycache |
|
353 | 352 | def changelog(self): |
|
354 | 353 | # consume the header if it exists |
|
355 | self.bundle.changelogheader() | |
|
356 | c = bundlechangelog(self.svfs, self.bundle) | |
|
357 | self.manstart = self.bundle.tell() | |
|
354 | self._bundle.changelogheader() | |
|
355 | c = bundlechangelog(self.svfs, self._bundle) | |
|
356 | self.manstart = self._bundle.tell() | |
|
358 | 357 | return c |
|
359 | 358 | |
|
360 | 359 | def _constructmanifest(self): |
|
361 | self.bundle.seek(self.manstart) | |
|
360 | self._bundle.seek(self.manstart) | |
|
362 | 361 | # consume the header if it exists |
|
363 | self.bundle.manifestheader() | |
|
362 | self._bundle.manifestheader() | |
|
364 | 363 | linkmapper = self.unfiltered().changelog.rev |
|
365 | m = bundlemanifest(self.svfs, self.bundle, linkmapper) | |
|
366 | self.filestart = self.bundle.tell() | |
|
364 | m = bundlemanifest(self.svfs, self._bundle, linkmapper) | |
|
365 | self.filestart = self._bundle.tell() | |
|
367 | 366 | return m |
|
368 | 367 | |
|
369 | 368 | def _consumemanifest(self): |
|
370 | 369 | """Consumes the manifest portion of the bundle, setting filestart so the |
|
371 | 370 | file portion can be read.""" |
|
372 | self.bundle.seek(self.manstart) | |
|
373 | self.bundle.manifestheader() | |
|
374 | for delta in self.bundle.deltaiter(): | |
|
371 | self._bundle.seek(self.manstart) | |
|
372 | self._bundle.manifestheader() | |
|
373 | for delta in self._bundle.deltaiter(): | |
|
375 | 374 | pass |
|
376 | self.filestart = self.bundle.tell() | |
|
375 | self.filestart = self._bundle.tell() | |
|
377 | 376 | |
|
378 | 377 | @localrepo.unfilteredpropertycache |
|
379 | 378 | def manstart(self): |
@@ -398,19 +397,19 b' class bundlerepository(localrepo.localre' | |||
|
398 | 397 | |
|
399 | 398 | def file(self, f): |
|
400 | 399 | if not self.bundlefilespos: |
|
401 | self.bundle.seek(self.filestart) | |
|
402 | self.bundlefilespos = _getfilestarts(self.bundle) | |
|
400 | self._bundle.seek(self.filestart) | |
|
401 | self.bundlefilespos = _getfilestarts(self._bundle) | |
|
403 | 402 | |
|
404 | 403 | if f in self.bundlefilespos: |
|
405 | self.bundle.seek(self.bundlefilespos[f]) | |
|
404 | self._bundle.seek(self.bundlefilespos[f]) | |
|
406 | 405 | linkmapper = self.unfiltered().changelog.rev |
|
407 | return bundlefilelog(self.svfs, f, self.bundle, linkmapper) | |
|
406 | return bundlefilelog(self.svfs, f, self._bundle, linkmapper) | |
|
408 | 407 | else: |
|
409 | 408 | return filelog.filelog(self.svfs, f) |
|
410 | 409 | |
|
411 | 410 | def close(self): |
|
412 | 411 | """Close assigned bundle file immediately.""" |
|
413 | self.bundlefile.close() | |
|
412 | self._bundlefile.close() | |
|
414 | 413 | if self.tempfile is not None: |
|
415 | 414 | self.vfs.unlink(self.tempfile) |
|
416 | 415 | if self._tempparent: |
General Comments 0
You need to be logged in to leave comments.
Login now