Skip to content
Snippets Groups Projects

introduce subclass for delta-search

Merged Pierre-Yves David requested to merge topic/default/better-delta.class-split into branch/default
1 file
+ 42
30
Compare changes
  • Side-by-side
  • Inline
@@ -767,8 +767,6 @@
return False
return True
def _pre_filter_rev(self, rev):
"""return True if it seems okay to test a rev, False otherwise"""
if not self._pre_filter_rev_universal(rev):
return False
def _pre_filter_rev_sparse(self, rev):
"""pre filtering that is needed in sparse revlog cases
@@ -774,9 +772,3 @@
deltas_limit = self.revinfo.textlen * LIMIT_DELTA2TEXT
# filter out delta base that will never produce good delta
#
# if the delta of that base is already bigger than the limit
# for the delta chain size, doing a delta is hopeless.
if deltas_limit < self.revlog.length(rev):
return False
return True if it seems okay to test a rev, False otherwise.
@@ -782,4 +774,6 @@
sparse = self.revlog.delta_config.sparse_revlog
used by _pre_filter_rev.
"""
assert self.revlog.delta_config.sparse_revlog
# if the revision we test again is too small, the resulting delta
# will be large anyway as that amount of data to be added is big
@@ -784,7 +778,5 @@
# if the revision we test again is too small, the resulting delta
# will be large anyway as that amount of data to be added is big
if sparse and self.revlog.rawsize(rev) < (
self.textlen // LIMIT_BASE2TEXT
):
if self.revlog.rawsize(rev) < (self.textlen // LIMIT_BASE2TEXT):
return False
@@ -789,20 +781,6 @@
return False
# If we reach here, we are about to build and test a delta.
# The delta building process will compute the chaininfo in all
# case, since that computation is cached, it is fine to access
# it here too.
chainlen, chainsize = self.revlog._chaininfo(rev)
# if chain will be too long, skip base
if (
self.revlog.delta_config.max_chain_len
and chainlen >= self.revlog.delta_config.max_chain_len
):
return False
# if chain already have too much data, skip base
if deltas_limit < chainsize:
return False
if sparse and self.revlog.delta_config.upper_bound_comp is not None:
if self.revlog.delta_config.upper_bound_comp is not None:
maxcomp = self.revlog.delta_config.upper_bound_comp
basenotsnap = (self.p1, self.p2, nullrev)
if rev not in basenotsnap and self.revlog.issnapshot(rev):
@@ -830,6 +808,40 @@
return False
return True
def _pre_filter_rev(self, rev):
"""return True if it seems okay to test a rev, False otherwise"""
if not self._pre_filter_rev_universal(rev):
return False
deltas_limit = self.revinfo.textlen * LIMIT_DELTA2TEXT
# filter out delta base that will never produce good delta
#
# if the delta of that base is already bigger than the limit
# for the delta chain size, doing a delta is hopeless.
if deltas_limit < self.revlog.length(rev):
return False
# If we reach here, we are about to build and test a delta.
# The delta building process will compute the chaininfo in all
# case, since that computation is cached, it is fine to access
# it here too.
chainlen, chainsize = self.revlog._chaininfo(rev)
# if chain will be too long, skip base
if (
self.revlog.delta_config.max_chain_len
and chainlen >= self.revlog.delta_config.max_chain_len
):
return False
# if chain already have too much data, skip base
if deltas_limit < chainsize:
return False
if self.revlog.delta_config.sparse_revlog:
if not self._pre_filter_rev_sparse(rev):
return False
return True
def _refined_groups(self):
good = None
# First we try to reuse a the delta contained in the bundle. (or from
Loading