# HG changeset patch # User Pierre-Yves David # Date 1687039493 -7200 # Node ID f1b57672cb94bc6da3e97afdc2bab7af9a254733 # Parent e7ef11b75fdcacf7e3e1fa5494a35bb4718586d7 delta-find: remove dead code intended to deal with forced delta reuse Since the case was dealt with sooner (see XXX), we no longer need to deal with it in this part of the code. diff -r e7ef11b75fdc -r f1b57672cb94 mercurial/revlogutils/deltas.py --- a/mercurial/revlogutils/deltas.py Thu Apr 20 15:56:58 2023 -0400 +++ b/mercurial/revlogutils/deltas.py Sun Jun 18 00:04:53 2023 +0200 @@ -585,12 +585,14 @@ if deltainfo is None: return False - if ( - revinfo.cachedelta is not None - and deltainfo.base == revinfo.cachedelta[0] - and revinfo.cachedelta[2] == DELTA_BASE_REUSE_FORCE - ): - return True + # the DELTA_BASE_REUSE_FORCE case should have been taken care of sooner so + # we should never end up asking such question. Adding the assert as a + # safe-guard to detect anything that would be fishy in this regard. + assert ( + revinfo.cachedelta is None + or revinfo.cachedelta[2] != DELTA_BASE_REUSE_FORCE + or not revlog._generaldelta + ) # - 'deltainfo.distance' is the distance from the base revision -- # bounding it limits the amount of I/O we need to do. @@ -693,14 +695,14 @@ yield None return - if ( - cachedelta is not None - and nullrev == cachedelta[0] - and cachedelta[2] == DELTA_BASE_REUSE_FORCE - ): - # instruction are to forcibly do a full snapshot - yield None - return + # the DELTA_BASE_REUSE_FORCE case should have been taken care of sooner so + # we should never end up asking such question. Adding the assert as a + # safe-guard to detect anything that would be fishy in this regard. + assert ( + cachedelta is None + or cachedelta[2] != DELTA_BASE_REUSE_FORCE + or not revlog._generaldelta + ) deltalength = revlog.length deltaparent = revlog.deltaparent @@ -736,15 +738,6 @@ if rev in tested: continue - if ( - cachedelta is not None - and rev == cachedelta[0] - and cachedelta[2] == DELTA_BASE_REUSE_FORCE - ): - # instructions are to forcibly consider/use this delta base - group.append(rev) - continue - # an higher authority deamed the base unworthy (e.g. censored) if excluded_bases is not None and rev in excluded_bases: tested.add(rev)