Mercurial > public > mercurial-scm > hg
comparison mercurial/revlogutils/deltas.py @ 51351:94fe4474b053
delta-find: move the emotion of prev in a dedicated method
After splitting the filtering, and with the `_candidate_groups` layer removed,
we can start splitting the group generation too. This helps to organize this
code and make it easier to modifying the future.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 23 Nov 2023 21:44:51 +0100 |
parents | 5cc04a6da19d |
children | fac6038b11f5 |
comparison
equal
deleted
inserted
replaced
51350:5cc04a6da19d | 51351:94fe4474b053 |
---|---|
1071 # then the other one (min rev) if the first did not fit | 1071 # then the other one (min rev) if the first did not fit |
1072 yield (parents[0],) | 1072 yield (parents[0],) |
1073 elif len(parents) > 0: | 1073 elif len(parents) > 0: |
1074 # Test all parents (1 or 2), and keep the best candidate | 1074 # Test all parents (1 or 2), and keep the best candidate |
1075 yield parents | 1075 yield parents |
1076 | |
1077 def _iter_prev(self): | |
1078 # other approach failed try against prev to hopefully save us a | |
1079 # fulltext. | |
1080 self.current_stage = _STAGE_PREV | |
1081 yield (self.target_rev - 1,) | |
1076 | 1082 |
1077 def _refined_groups(self): | 1083 def _refined_groups(self): |
1078 good = None | 1084 good = None |
1079 groups = self._raw_groups() | 1085 groups = self._raw_groups() |
1080 for candidates in groups: | 1086 for candidates in groups: |
1219 if snapfloor <= r | 1225 if snapfloor <= r |
1220 ] | 1226 ] |
1221 yield tuple(sorted(full)) | 1227 yield tuple(sorted(full)) |
1222 | 1228 |
1223 if not sparse: | 1229 if not sparse: |
1224 # other approach failed try against prev to hopefully save us a | 1230 yield from self._iter_prev() |
1225 # fulltext. | |
1226 self.current_stage = _STAGE_PREV | |
1227 yield (prev,) | |
1228 | 1231 |
1229 | 1232 |
1230 class SnapshotCache: | 1233 class SnapshotCache: |
1231 __slots__ = ('snapshots', '_start_rev', '_end_rev') | 1234 __slots__ = ('snapshots', '_start_rev', '_end_rev') |
1232 | 1235 |