comparison mercurial/bundlerepo.py @ 18115:6db318a15a12

bundlerepo: use _cacheabletip mechanism in bundlerepo Instead of preventing any cache write we allow writing cache for all content of the original repo. The motivation for this change is to drop the custom _writebranchcache of bundlerepo to help extraction of the branchmap logic out of localrepo.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Thu, 20 Dec 2012 12:17:44 +0100
parents a39fe76c4c65
children 11d1a9143adb
comparison
equal deleted inserted replaced
18114:35ce17796e0e 18115:6db318a15a12
30 # 30 #
31 revlog.revlog.__init__(self, opener, indexfile) 31 revlog.revlog.__init__(self, opener, indexfile)
32 self.bundle = bundle 32 self.bundle = bundle
33 self.basemap = {} 33 self.basemap = {}
34 n = len(self) 34 n = len(self)
35 self.disktiprev = n - 1
35 chain = None 36 chain = None
36 self.bundlenodes = [] 37 self.bundlenodes = []
37 while True: 38 while True:
38 chunkdata = bundle.deltachunk(chain) 39 chunkdata = bundle.deltachunk(chain)
39 if not chunkdata: 40 if not chunkdata:
282 return bundlepeer(self) 283 return bundlepeer(self)
283 284
284 def getcwd(self): 285 def getcwd(self):
285 return os.getcwd() # always outside the repo 286 return os.getcwd() # always outside the repo
286 287
287 def _writebranchcache(self, branches, tip, tiprev): 288 def _cacheabletip(self):
288 # don't overwrite the disk cache with bundle-augmented data 289 # we should not cache data from the bundle on disk
289 pass 290 ret = super(bundlerepository, self)._cacheabletip()
291 return min(self.changelog.disktiprev, ret)
292
290 293
291 def instance(ui, path, create): 294 def instance(ui, path, create):
292 if create: 295 if create:
293 raise util.Abort(_('cannot create new bundle repository')) 296 raise util.Abort(_('cannot create new bundle repository'))
294 parentpath = ui.config("bundle", "mainreporoot", "") 297 parentpath = ui.config("bundle", "mainreporoot", "")