comparison mercurial/bundlerepo.py @ 35011:a2dfc723b6b5

bundle: allow bundlerepo to support alternative manifest implementations With our treemanifest logic, the manifests are no longer transported as part of the changegroup and are no longer stored in a revlog. This means the self.manifestlog line in bundlerepo.filestart no longer calls _constructmanifest, and therefore does not consume the manifest portion of the changegroup, which means filestart is not populated and we result in an infinite loop. The fix is to make filestart aware that self.manifestlog might not consume the changegroup part, and consume it manually if necessary. There's currently no way to test this in core, but our treemanifest extension has tests to cover this. Differential Revision: https://phab.mercurial-scm.org/D1329
author Durham Goode <durham@fb.com>
date Tue, 07 Nov 2017 10:16:53 -0800
parents 0fe62d8bdd50
children 32d079f37207
comparison
equal deleted inserted replaced
35010:b81ad5b78a81 35011:a2dfc723b6b5
350 linkmapper = self.unfiltered().changelog.rev 350 linkmapper = self.unfiltered().changelog.rev
351 m = bundlemanifest(self.svfs, self.bundle, linkmapper) 351 m = bundlemanifest(self.svfs, self.bundle, linkmapper)
352 self.filestart = self.bundle.tell() 352 self.filestart = self.bundle.tell()
353 return m 353 return m
354 354
355 def _consumemanifest(self):
356 """Consumes the manifest portion of the bundle, setting filestart so the
357 file portion can be read."""
358 self.bundle.seek(self.manstart)
359 self.bundle.manifestheader()
360 for delta in self.bundle.deltaiter():
361 pass
362 self.filestart = self.bundle.tell()
363
355 @localrepo.unfilteredpropertycache 364 @localrepo.unfilteredpropertycache
356 def manstart(self): 365 def manstart(self):
357 self.changelog 366 self.changelog
358 return self.manstart 367 return self.manstart
359 368
360 @localrepo.unfilteredpropertycache 369 @localrepo.unfilteredpropertycache
361 def filestart(self): 370 def filestart(self):
362 self.manifestlog 371 self.manifestlog
372
373 # If filestart was not set by self.manifestlog, that means the
374 # manifestlog implementation did not consume the manifests from the
375 # changegroup (ex: it might be consuming trees from a separate bundle2
376 # part instead). So we need to manually consume it.
377 if 'filestart' not in self.__dict__:
378 self._consumemanifest()
379
363 return self.filestart 380 return self.filestart
364 381
365 def url(self): 382 def url(self):
366 return self._url 383 return self._url
367 384