##// END OF EJS Templates
delta-find: split the _DeltaSearch class in two...
marmoute -
r52250:d7e2acdd default
parent child Browse files
Show More
@@ -828,11 +828,8 b' class _PrevDeltaSearch(_BaseDeltaSearch)'
828 self.current_group = None
828 self.current_group = None
829
829
830
830
831 class _DeltaSearch(_BaseDeltaSearch):
831 class _GeneralDeltaSearch(_BaseDeltaSearch):
832 """Generic delta search variants
832 """Delta search variant for general-delta repository"""
833
834 (expect this to be split further)
835 """
836
833
837 def _init_group(self):
834 def _init_group(self):
838 # Why search for delta base if we cannot use a delta base ?
835 # Why search for delta base if we cannot use a delta base ?
@@ -1080,6 +1077,21 b' class _DeltaSearch(_BaseDeltaSearch):'
1080 self.current_stage = _STAGE_PREV
1077 self.current_stage = _STAGE_PREV
1081 yield (self.target_rev - 1,)
1078 yield (self.target_rev - 1,)
1082
1079
1080 def _iter_groups(self):
1081 good = None
1082 for group in self._iter_parents():
1083 good = yield group
1084 if good is not None:
1085 break
1086 else:
1087 assert good is None
1088 yield from self._iter_prev()
1089 yield None
1090
1091
1092 class _SparseDeltaSearch(_GeneralDeltaSearch):
1093 """Delta search variants for sparse-revlog"""
1094
1083 def _iter_snapshots_base(self):
1095 def _iter_snapshots_base(self):
1084 assert self.revlog.delta_config.sparse_revlog
1096 assert self.revlog.delta_config.sparse_revlog
1085 assert self.current_stage == _STAGE_SNAPSHOT
1097 assert self.current_stage == _STAGE_SNAPSHOT
@@ -1217,16 +1229,14 b' class _DeltaSearch(_BaseDeltaSearch):'
1217 break
1229 break
1218 else:
1230 else:
1219 assert good is None
1231 assert good is None
1220 if self.revlog.delta_config.sparse_revlog:
1232 assert self.revlog.delta_config.sparse_revlog
1221 # If sparse revlog is enabled, we can try to refine the
1233 # If sparse revlog is enabled, we can try to refine the
1222 # available deltas
1234 # available deltas
1223 iter_snap = self._iter_snapshots()
1235 iter_snap = self._iter_snapshots()
1224 group = iter_snap.send(None)
1236 group = iter_snap.send(None)
1225 while group is not None:
1237 while group is not None:
1226 good = yield group
1238 good = yield group
1227 group = iter_snap.send(good)
1239 group = iter_snap.send(good)
1228 else:
1229 yield from self._iter_prev()
1230 yield None
1240 yield None
1231
1241
1232
1242
@@ -1605,11 +1615,13 b' class deltacomputer:'
1605 # should we try to build a delta?
1615 # should we try to build a delta?
1606 if not (len(self.revlog) and self.revlog._storedeltachains):
1616 if not (len(self.revlog) and self.revlog._storedeltachains):
1607 search_cls = _NoDeltaSearch
1617 search_cls = _NoDeltaSearch
1608 elif not self.revlog.delta_config.general_delta:
1618 elif self.revlog.delta_config.sparse_revlog:
1619 search_cls = _SparseDeltaSearch
1620 elif self.revlog.delta_config.general_delta:
1621 search_cls = _GeneralDeltaSearch
1622 else:
1609 # before general delta, there is only one possible delta base
1623 # before general delta, there is only one possible delta base
1610 search_cls = _PrevDeltaSearch
1624 search_cls = _PrevDeltaSearch
1611 else:
1612 search_cls = _DeltaSearch
1613
1625
1614 search = search_cls(
1626 search = search_cls(
1615 self.revlog,
1627 self.revlog,
General Comments 0
You need to be logged in to leave comments. Login now