##// END OF EJS Templates
revlog: add the option to track the expected compression upper bound...
marmoute -
r42662:bc4373ba default
parent child Browse files
Show More
@@ -2277,6 +2277,10 b' def _temprevlog(ui, orig, truncaterev):'
2277
2277
2278 if orig._inline:
2278 if orig._inline:
2279 raise error.Abort('not supporting inline revlog (yet)')
2279 raise error.Abort('not supporting inline revlog (yet)')
2280 revlogkwargs = {}
2281 k = 'upperboundcomp'
2282 if util.safehasattr(orig, k):
2283 revlogkwargs[k] = getattr(orig, k)
2280
2284
2281 origindexpath = orig.opener.join(orig.indexfile)
2285 origindexpath = orig.opener.join(orig.indexfile)
2282 origdatapath = orig.opener.join(orig.datafile)
2286 origdatapath = orig.opener.join(orig.datafile)
@@ -2308,7 +2312,7 b' def _temprevlog(ui, orig, truncaterev):'
2308
2312
2309 dest = revlog.revlog(vfs,
2313 dest = revlog.revlog(vfs,
2310 indexfile=indexname,
2314 indexfile=indexname,
2311 datafile=dataname)
2315 datafile=dataname, **revlogkwargs)
2312 if dest._inline:
2316 if dest._inline:
2313 raise error.Abort('not supporting inline revlog (yet)')
2317 raise error.Abort('not supporting inline revlog (yet)')
2314 # make sure internals are initialized
2318 # make sure internals are initialized
@@ -1417,6 +1417,10 b' class manifestfulltextcache(util.lrucach'
1417 self.write()
1417 self.write()
1418 self._read = False
1418 self._read = False
1419
1419
1420 # and upper bound of what we expect from compression
1421 # (real live value seems to be "3")
1422 MAXCOMPRESSION = 10
1423
1420 @interfaceutil.implementer(repository.imanifeststorage)
1424 @interfaceutil.implementer(repository.imanifeststorage)
1421 class manifestrevlog(object):
1425 class manifestrevlog(object):
1422 '''A revlog that stores manifest texts. This is responsible for caching the
1426 '''A revlog that stores manifest texts. This is responsible for caching the
@@ -1467,7 +1471,8 b' class manifestrevlog(object):'
1467 self._revlog = revlog.revlog(opener, indexfile,
1471 self._revlog = revlog.revlog(opener, indexfile,
1468 # only root indexfile is cached
1472 # only root indexfile is cached
1469 checkambig=not bool(tree),
1473 checkambig=not bool(tree),
1470 mmaplargeindex=True)
1474 mmaplargeindex=True,
1475 upperboundcomp=MAXCOMPRESSION)
1471
1476
1472 self.index = self._revlog.index
1477 self.index = self._revlog.index
1473 self.version = self._revlog.version
1478 self.version = self._revlog.version
@@ -334,15 +334,21 b' class revlog(object):'
334 configured threshold.
334 configured threshold.
335
335
336 If censorable is True, the revlog can have censored revisions.
336 If censorable is True, the revlog can have censored revisions.
337
338 If `upperboundcomp` is not None, this is the expected maximal gain from
339 compression for the data content.
337 """
340 """
338 def __init__(self, opener, indexfile, datafile=None, checkambig=False,
341 def __init__(self, opener, indexfile, datafile=None, checkambig=False,
339 mmaplargeindex=False, censorable=False):
342 mmaplargeindex=False, censorable=False,
343 upperboundcomp=None):
340 """
344 """
341 create a revlog object
345 create a revlog object
342
346
343 opener is a function that abstracts the file opening operation
347 opener is a function that abstracts the file opening operation
344 and can be used to implement COW semantics or the like.
348 and can be used to implement COW semantics or the like.
349
345 """
350 """
351 self.upperboundcomp = upperboundcomp
346 self.indexfile = indexfile
352 self.indexfile = indexfile
347 self.datafile = datafile or (indexfile[:-2] + ".d")
353 self.datafile = datafile or (indexfile[:-2] + ".d")
348 self.opener = opener
354 self.opener = opener
General Comments 0
You need to be logged in to leave comments. Login now