equal
deleted
inserted
replaced
280 self._pcache = {} |
280 self._pcache = {} |
281 # Mapping of revision integer to full node. |
281 # Mapping of revision integer to full node. |
282 self._nodecache = {nullid: nullrev} |
282 self._nodecache = {nullid: nullrev} |
283 self._nodepos = None |
283 self._nodepos = None |
284 self._compengine = 'zlib' |
284 self._compengine = 'zlib' |
|
285 self._maxdeltachainspan = -1 |
285 |
286 |
286 v = REVLOG_DEFAULT_VERSION |
287 v = REVLOG_DEFAULT_VERSION |
287 opts = getattr(opener, 'options', None) |
288 opts = getattr(opener, 'options', None) |
288 if opts is not None: |
289 if opts is not None: |
289 if 'revlogv1' in opts: |
290 if 'revlogv1' in opts: |
298 if 'aggressivemergedeltas' in opts: |
299 if 'aggressivemergedeltas' in opts: |
299 self._aggressivemergedeltas = opts['aggressivemergedeltas'] |
300 self._aggressivemergedeltas = opts['aggressivemergedeltas'] |
300 self._lazydeltabase = bool(opts.get('lazydeltabase', False)) |
301 self._lazydeltabase = bool(opts.get('lazydeltabase', False)) |
301 if 'compengine' in opts: |
302 if 'compengine' in opts: |
302 self._compengine = opts['compengine'] |
303 self._compengine = opts['compengine'] |
|
304 if 'maxdeltachainspan' in opts: |
|
305 self._maxdeltachainspan = opts['maxdeltachainspan'] |
303 |
306 |
304 if self._chunkcachesize <= 0: |
307 if self._chunkcachesize <= 0: |
305 raise RevlogError(_('revlog chunk cache size %r is not greater ' |
308 raise RevlogError(_('revlog chunk cache size %r is not greater ' |
306 'than 0') % self._chunkcachesize) |
309 'than 0') % self._chunkcachesize) |
307 elif self._chunkcachesize & (self._chunkcachesize - 1): |
310 elif self._chunkcachesize & (self._chunkcachesize - 1): |
1594 # - 'dist' is the distance from the base revision -- bounding it limits |
1597 # - 'dist' is the distance from the base revision -- bounding it limits |
1595 # the amount of I/O we need to do. |
1598 # the amount of I/O we need to do. |
1596 # - 'compresseddeltalen' is the sum of the total size of deltas we need |
1599 # - 'compresseddeltalen' is the sum of the total size of deltas we need |
1597 # to apply -- bounding it limits the amount of CPU we consume. |
1600 # to apply -- bounding it limits the amount of CPU we consume. |
1598 dist, l, data, base, chainbase, chainlen, compresseddeltalen = d |
1601 dist, l, data, base, chainbase, chainlen, compresseddeltalen = d |
1599 if (dist > textlen * 4 or l > textlen or |
1602 |
|
1603 defaultmax = textlen * 4 |
|
1604 maxdist = self._maxdeltachainspan |
|
1605 if not maxdist: |
|
1606 maxdist = dist # ensure the conditional pass |
|
1607 maxdist = max(maxdist, defaultmax) |
|
1608 if (dist > maxdist or l > textlen or |
1600 compresseddeltalen > textlen * 2 or |
1609 compresseddeltalen > textlen * 2 or |
1601 (self._maxchainlen and chainlen > self._maxchainlen)): |
1610 (self._maxchainlen and chainlen > self._maxchainlen)): |
1602 return False |
1611 return False |
1603 |
1612 |
1604 return True |
1613 return True |