##// END OF EJS Templates
delta-find: add a simple safeguard to prevent bad non-general-delta...
marmoute -
r51332:2a6949ab stable
parent child Browse files
Show More
@@ -1135,7 +1135,7 b' class deltacomputer:'
1135
1135
1136 return delta
1136 return delta
1137
1137
1138 def _builddeltainfo(self, revinfo, base, fh):
1138 def _builddeltainfo(self, revinfo, base, fh, target_rev=None):
1139 # can we use the cached delta?
1139 # can we use the cached delta?
1140 revlog = self.revlog
1140 revlog = self.revlog
1141 debug_search = self._write_debug is not None and self._debug_search
1141 debug_search = self._write_debug is not None and self._debug_search
@@ -1143,6 +1143,13 b' class deltacomputer:'
1143 if revlog._generaldelta:
1143 if revlog._generaldelta:
1144 deltabase = base
1144 deltabase = base
1145 else:
1145 else:
1146 if target_rev is not None and base != target_rev - 1:
1147 msg = (
1148 b'general delta cannot use delta for something else '
1149 b'than `prev`: %d<-%d'
1150 )
1151 msg %= (base, target_rev)
1152 raise error.ProgrammingError(msg)
1146 deltabase = chainbase
1153 deltabase = chainbase
1147 snapshotdepth = None
1154 snapshotdepth = None
1148 if revlog._sparserevlog and deltabase == nullrev:
1155 if revlog._sparserevlog and deltabase == nullrev:
@@ -1373,7 +1380,12 b' class deltacomputer:'
1373
1380
1374 if debug_search:
1381 if debug_search:
1375 delta_start = util.timer()
1382 delta_start = util.timer()
1376 candidatedelta = self._builddeltainfo(revinfo, candidaterev, fh)
1383 candidatedelta = self._builddeltainfo(
1384 revinfo,
1385 candidaterev,
1386 fh,
1387 target_rev=target_rev,
1388 )
1377 if debug_search:
1389 if debug_search:
1378 delta_end = util.timer()
1390 delta_end = util.timer()
1379 msg = b"DBG-DELTAS-SEARCH: delta-search-time=%f\n"
1391 msg = b"DBG-DELTAS-SEARCH: delta-search-time=%f\n"
General Comments 0
You need to be logged in to leave comments. Login now