comparison mercurial/revlogutils/deltas.py @ 51083:5645524c6b62

revlog: also migrates `revlog.upperboundcomp` to ConfigClass This was planned but overlooked when doing the rest of the migration.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 13 Oct 2023 16:11:04 +0200
parents 26dcdbe15024
children a82704902db8
comparison
equal deleted inserted replaced
51082:808f1e38cd1d 51083:5645524c6b62
782 continue 782 continue
783 # if chain already have too much data, skip base 783 # if chain already have too much data, skip base
784 if deltas_limit < chainsize: 784 if deltas_limit < chainsize:
785 tested.add(rev) 785 tested.add(rev)
786 continue 786 continue
787 if sparse and revlog.upperboundcomp is not None: 787 if sparse and revlog.delta_config.upper_bound_comp is not None:
788 maxcomp = revlog.upperboundcomp 788 maxcomp = revlog.delta_config.upper_bound_comp
789 basenotsnap = (p1, p2, nullrev) 789 basenotsnap = (p1, p2, nullrev)
790 if rev not in basenotsnap and revlog.issnapshot(rev): 790 if rev not in basenotsnap and revlog.issnapshot(rev):
791 snapshotdepth = revlog.snapshotdepth(rev) 791 snapshotdepth = revlog.snapshotdepth(rev)
792 # If text is significantly larger than the base, we can 792 # If text is significantly larger than the base, we can
793 # expect the resulting delta to be proportional to the size 793 # expect the resulting delta to be proportional to the size
1184 if self._debug_search: 1184 if self._debug_search:
1185 msg = b"DBG-DELTAS-SEARCH: uncompressed-delta-size=%d\n" 1185 msg = b"DBG-DELTAS-SEARCH: uncompressed-delta-size=%d\n"
1186 msg %= len(delta) 1186 msg %= len(delta)
1187 self._write_debug(msg) 1187 self._write_debug(msg)
1188 # snapshotdept need to be neither None nor 0 level snapshot 1188 # snapshotdept need to be neither None nor 0 level snapshot
1189 if revlog.upperboundcomp is not None and snapshotdepth: 1189 if revlog.delta_config.upper_bound_comp is not None and snapshotdepth:
1190 lowestrealisticdeltalen = len(delta) // revlog.upperboundcomp 1190 lowestrealisticdeltalen = (
1191 len(delta) // revlog.delta_config.upper_bound_comp
1192 )
1191 snapshotlimit = revinfo.textlen >> snapshotdepth 1193 snapshotlimit = revinfo.textlen >> snapshotdepth
1192 if self._debug_search: 1194 if self._debug_search:
1193 msg = b"DBG-DELTAS-SEARCH: projected-lower-size=%d\n" 1195 msg = b"DBG-DELTAS-SEARCH: projected-lower-size=%d\n"
1194 msg %= lowestrealisticdeltalen 1196 msg %= lowestrealisticdeltalen
1195 self._write_debug(msg) 1197 self._write_debug(msg)