Mercurial > hg
comparison mercurial/revlogutils/deltas.py @ 49768:bcae90c53def
delta-find: add a delta-reuse policy that blindly accepts incoming deltas
When this policy is set, incoming deltas are blindly accepted without regard
for the validity of the chain they build.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 07 Nov 2022 22:30:30 -0500 |
parents | c261a628e525 |
children | d57b966cdeb1 |
comparison
equal
deleted
inserted
replaced
49767:f1887500f3ec | 49768:bcae90c53def |
---|---|
18 | 18 |
19 from .constants import ( | 19 from .constants import ( |
20 COMP_MODE_DEFAULT, | 20 COMP_MODE_DEFAULT, |
21 COMP_MODE_INLINE, | 21 COMP_MODE_INLINE, |
22 COMP_MODE_PLAIN, | 22 COMP_MODE_PLAIN, |
23 DELTA_BASE_REUSE_FORCE, | |
23 DELTA_BASE_REUSE_NO, | 24 DELTA_BASE_REUSE_NO, |
24 KIND_CHANGELOG, | 25 KIND_CHANGELOG, |
25 KIND_FILELOG, | 26 KIND_FILELOG, |
26 KIND_MANIFESTLOG, | 27 KIND_MANIFESTLOG, |
27 REVIDX_ISCENSORED, | 28 REVIDX_ISCENSORED, |
581 """Returns True if the given delta is good. Good means that it is within | 582 """Returns True if the given delta is good. Good means that it is within |
582 the disk span, disk size, and chain length bounds that we know to be | 583 the disk span, disk size, and chain length bounds that we know to be |
583 performant.""" | 584 performant.""" |
584 if deltainfo is None: | 585 if deltainfo is None: |
585 return False | 586 return False |
587 | |
588 if ( | |
589 revinfo.cachedelta is not None | |
590 and deltainfo.base == revinfo.cachedelta[0] | |
591 and revinfo.cachedelta[2] == DELTA_BASE_REUSE_FORCE | |
592 ): | |
593 return True | |
586 | 594 |
587 # - 'deltainfo.distance' is the distance from the base revision -- | 595 # - 'deltainfo.distance' is the distance from the base revision -- |
588 # bounding it limits the amount of I/O we need to do. | 596 # bounding it limits the amount of I/O we need to do. |
589 # - 'deltainfo.compresseddeltalen' is the sum of the total size of | 597 # - 'deltainfo.compresseddeltalen' is the sum of the total size of |
590 # deltas we need to apply -- bounding it limits the amount of CPU | 598 # deltas we need to apply -- bounding it limits the amount of CPU |
709 if rev == nullrev: | 717 if rev == nullrev: |
710 continue | 718 continue |
711 # filter out revision we tested already | 719 # filter out revision we tested already |
712 if rev in tested: | 720 if rev in tested: |
713 continue | 721 continue |
722 | |
723 if ( | |
724 cachedelta is not None | |
725 and rev == cachedelta[0] | |
726 and cachedelta[2] == DELTA_BASE_REUSE_FORCE | |
727 ): | |
728 # instructions are to forcibly consider/use this delta base | |
729 group.append(rev) | |
730 continue | |
731 | |
714 # an higher authority deamed the base unworthy (e.g. censored) | 732 # an higher authority deamed the base unworthy (e.g. censored) |
715 if excluded_bases is not None and rev in excluded_bases: | 733 if excluded_bases is not None and rev in excluded_bases: |
716 tested.add(rev) | 734 tested.add(rev) |
717 continue | 735 continue |
718 # We are in some recomputation cases and that rev is too high in | 736 # We are in some recomputation cases and that rev is too high in |