Mercurial > public > mercurial-scm > hg
comparison mercurial/revlogutils/deltas.py @ 51057:f71f07a679b4
revlog: remove legacy usage of `_sparserevlog`
All core code is now getting the setting from the DeltaConfig object.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 10 Oct 2023 11:27:39 +0200 |
parents | 8bdb2478c4bc |
children | 8c614fa16330 |
comparison
equal
deleted
inserted
replaced
51056:47d43efda8b7 | 51057:f71f07a679b4 |
---|---|
620 # In the sparse-revlog case, we rely on the associated "sparse reading" | 620 # In the sparse-revlog case, we rely on the associated "sparse reading" |
621 # to avoid issue related to the span of data. In theory, it would be | 621 # to avoid issue related to the span of data. In theory, it would be |
622 # possible to build pathological revlog where delta pattern would lead | 622 # possible to build pathological revlog where delta pattern would lead |
623 # to too many reads. However, they do not happen in practice at all. So | 623 # to too many reads. However, they do not happen in practice at all. So |
624 # we skip the span check entirely. | 624 # we skip the span check entirely. |
625 if not revlog._sparserevlog and maxdist < deltainfo.distance: | 625 if not revlog.delta_config.sparse_revlog and maxdist < deltainfo.distance: |
626 return False | 626 return False |
627 | 627 |
628 # Bad delta from new delta size: | 628 # Bad delta from new delta size: |
629 # | 629 # |
630 # If the delta size is larger than the target text, storing the | 630 # If the delta size is larger than the target text, storing the |
713 or not revlog.delta_config.general_delta | 713 or not revlog.delta_config.general_delta |
714 ) | 714 ) |
715 | 715 |
716 deltalength = revlog.length | 716 deltalength = revlog.length |
717 deltaparent = revlog.deltaparent | 717 deltaparent = revlog.deltaparent |
718 sparse = revlog._sparserevlog | 718 sparse = revlog.delta_config.sparse_revlog |
719 good = None | 719 good = None |
720 | 720 |
721 deltas_limit = textlen * LIMIT_DELTA2TEXT | 721 deltas_limit = textlen * LIMIT_DELTA2TEXT |
722 group_chunk_size = revlog.delta_config.candidate_group_chunk_size | 722 group_chunk_size = revlog.delta_config.candidate_group_chunk_size |
723 | 723 |
873 good = yield candidates | 873 good = yield candidates |
874 if good is not None: | 874 if good is not None: |
875 break | 875 break |
876 | 876 |
877 # If sparse revlog is enabled, we can try to refine the available deltas | 877 # If sparse revlog is enabled, we can try to refine the available deltas |
878 if not revlog._sparserevlog: | 878 if not revlog.delta_config.sparse_revlog: |
879 yield None | 879 yield None |
880 return | 880 return |
881 | 881 |
882 # if we have a refinable value, try to refine it | 882 # if we have a refinable value, try to refine it |
883 if good is not None and good not in (p1, p2) and revlog.issnapshot(good): | 883 if good is not None and good not in (p1, p2) and revlog.issnapshot(good): |
914 The group order aims at providing fast or small candidates first. | 914 The group order aims at providing fast or small candidates first. |
915 """ | 915 """ |
916 # Why search for delta base if we cannot use a delta base ? | 916 # Why search for delta base if we cannot use a delta base ? |
917 assert revlog.delta_config.general_delta | 917 assert revlog.delta_config.general_delta |
918 # also see issue6056 | 918 # also see issue6056 |
919 sparse = revlog._sparserevlog | 919 sparse = revlog.delta_config.sparse_revlog |
920 curr = len(revlog) | 920 curr = len(revlog) |
921 prev = curr - 1 | 921 prev = curr - 1 |
922 deltachain = lambda rev: revlog._deltachain(rev)[0] | 922 deltachain = lambda rev: revlog._deltachain(rev)[0] |
923 | 923 |
924 # exclude already lazy tested base if any | 924 # exclude already lazy tested base if any |
1156 ) | 1156 ) |
1157 msg %= (base, target_rev) | 1157 msg %= (base, target_rev) |
1158 raise error.ProgrammingError(msg) | 1158 raise error.ProgrammingError(msg) |
1159 deltabase = chainbase | 1159 deltabase = chainbase |
1160 snapshotdepth = None | 1160 snapshotdepth = None |
1161 if revlog._sparserevlog and deltabase == nullrev: | 1161 if revlog.delta_config.sparse_revlog and deltabase == nullrev: |
1162 snapshotdepth = 0 | 1162 snapshotdepth = 0 |
1163 elif revlog._sparserevlog and revlog.issnapshot(deltabase): | 1163 elif revlog.delta_config.sparse_revlog and revlog.issnapshot(deltabase): |
1164 # A delta chain should always be one full snapshot, | 1164 # A delta chain should always be one full snapshot, |
1165 # zero or more semi-snapshots, and zero or more deltas | 1165 # zero or more semi-snapshots, and zero or more deltas |
1166 p1, p2 = revlog.rev(revinfo.p1), revlog.rev(revinfo.p2) | 1166 p1, p2 = revlog.rev(revinfo.p1), revlog.rev(revinfo.p2) |
1167 if deltabase not in (p1, p2) and revlog.issnapshot(deltabase): | 1167 if deltabase not in (p1, p2) and revlog.issnapshot(deltabase): |
1168 snapshotdepth = len(revlog._deltachain(deltabase)[0]) | 1168 snapshotdepth = len(revlog._deltachain(deltabase)[0]) |