Show More
@@ -1262,8 +1262,10 b' class deltacomputer:' | |||
|
1262 | 1262 | gather_debug = self._gather_debug |
|
1263 | 1263 | cachedelta = revinfo.cachedelta |
|
1264 | 1264 | revlog = self.revlog |
|
1265 | p1r = p2r = None | |
|
1265 | 1266 | |
|
1266 | p1r = p2r = None | |
|
1267 | if excluded_bases is None: | |
|
1268 | excluded_bases = set() | |
|
1267 | 1269 | |
|
1268 | 1270 | if gather_debug: |
|
1269 | 1271 | start = util.timer() |
@@ -1310,15 +1312,80 b' class deltacomputer:' | |||
|
1310 | 1312 | 'delta-base' |
|
1311 | 1313 | ] = deltainfo.base # pytype: disable=attribute-error |
|
1312 | 1314 | dbg['search_round_count'] = 0 |
|
1313 |
dbg['using-cached-base'] = |
|
|
1315 | dbg['using-cached-base'] = False | |
|
1314 | 1316 | dbg['delta_try_count'] = 0 |
|
1315 | 1317 | dbg['type'] = b"full" |
|
1316 | 1318 | dbg['snapshot-depth'] = 0 |
|
1317 | 1319 | self._dbg_process_data(dbg) |
|
1318 | 1320 | return deltainfo |
|
1319 | 1321 | |
|
1320 | if excluded_bases is None: | |
|
1321 | excluded_bases = set() | |
|
1322 | deltainfo = None | |
|
1323 | ||
|
1324 | # If this source delta are to be forcibly reuse, let us comply early. | |
|
1325 | if ( | |
|
1326 | revlog._generaldelta | |
|
1327 | and revinfo.cachedelta is not None | |
|
1328 | and revinfo.cachedelta[2] == DELTA_BASE_REUSE_FORCE | |
|
1329 | ): | |
|
1330 | base = revinfo.cachedelta[0] | |
|
1331 | if base == nullrev: | |
|
1332 | dbg_type = b"full" | |
|
1333 | deltainfo = self._fullsnapshotinfo(fh, revinfo, target_rev) | |
|
1334 | if gather_debug: | |
|
1335 | snapshotdepth = 0 | |
|
1336 | elif base not in excluded_bases: | |
|
1337 | delta = revinfo.cachedelta[1] | |
|
1338 | header, data = revlog.compress(delta) | |
|
1339 | deltalen = len(header) + len(data) | |
|
1340 | if gather_debug: | |
|
1341 | offset = revlog.end(len(revlog) - 1) | |
|
1342 | chainbase = revlog.chainbase(base) | |
|
1343 | distance = deltalen + offset - revlog.start(chainbase) | |
|
1344 | chainlen, compresseddeltalen = revlog._chaininfo(base) | |
|
1345 | chainlen += 1 | |
|
1346 | compresseddeltalen += deltalen | |
|
1347 | if base == p1r or base == p2r: | |
|
1348 | dbg_type = b"delta" | |
|
1349 | snapshotdepth = None | |
|
1350 | elif not revlog.issnapshot(base): | |
|
1351 | snapshotdepth = None | |
|
1352 | else: | |
|
1353 | dbg_type = b"snapshot" | |
|
1354 | snapshotdepth = revlog.snapshotdepth(base) + 1 | |
|
1355 | else: | |
|
1356 | distance = None | |
|
1357 | chainbase = None | |
|
1358 | chainlen = None | |
|
1359 | compresseddeltalen = None | |
|
1360 | snapshotdepth = None | |
|
1361 | deltainfo = _deltainfo( | |
|
1362 | distance=distance, | |
|
1363 | deltalen=deltalen, | |
|
1364 | data=(header, data), | |
|
1365 | base=base, | |
|
1366 | chainbase=chainbase, | |
|
1367 | chainlen=chainlen, | |
|
1368 | compresseddeltalen=compresseddeltalen, | |
|
1369 | snapshotdepth=snapshotdepth, | |
|
1370 | ) | |
|
1371 | ||
|
1372 | if deltainfo is not None: | |
|
1373 | if gather_debug: | |
|
1374 | end = util.timer() | |
|
1375 | dbg['duration'] = end - start | |
|
1376 | dbg[ | |
|
1377 | 'delta-base' | |
|
1378 | ] = deltainfo.base # pytype: disable=attribute-error | |
|
1379 | dbg['search_round_count'] = 0 | |
|
1380 | dbg['using-cached-base'] = True | |
|
1381 | dbg['delta_try_count'] = 0 | |
|
1382 | dbg['type'] = b"full" | |
|
1383 | if snapshotdepth is None: | |
|
1384 | dbg['snapshot-depth'] = 0 | |
|
1385 | else: | |
|
1386 | dbg['snapshot-depth'] = snapshotdepth | |
|
1387 | self._dbg_process_data(dbg) | |
|
1388 | return deltainfo | |
|
1322 | 1389 | |
|
1323 | 1390 | # count the number of different delta we tried (for debug purpose) |
|
1324 | 1391 | dbg_try_count = 0 |
@@ -1326,7 +1393,6 b' class deltacomputer:' | |||
|
1326 | 1393 | dbg_try_rounds = 0 |
|
1327 | 1394 | dbg_type = b'unknown' |
|
1328 | 1395 | |
|
1329 | deltainfo = None | |
|
1330 | 1396 | if p1r is None: |
|
1331 | 1397 | p1r = revlog.rev(revinfo.p1) |
|
1332 | 1398 | p2r = revlog.rev(revinfo.p2) |
@@ -329,8 +329,8 b' more subtle to test this behavior.' | |||
|
329 | 329 | DBG-DELTAS: CHANGELOG: * (glob) |
|
330 | 330 | DBG-DELTAS: MANIFESTLOG: * (glob) |
|
331 | 331 | DBG-DELTAS: MANIFESTLOG: * (glob) |
|
332 |
DBG-DELTAS: FILELOG:my-file.txt: rev=3: delta-base=2 is-cached=1 *search-rounds= |
|
|
333 |
DBG-DELTAS: FILELOG:my-file.txt: rev=4: delta-base=3 is-cached=1 *search-rounds= |
|
|
332 | DBG-DELTAS: FILELOG:my-file.txt: rev=3: delta-base=2 is-cached=1 *search-rounds=0 try-count=0* (glob) | |
|
333 | DBG-DELTAS: FILELOG:my-file.txt: rev=4: delta-base=3 is-cached=1 *search-rounds=0 try-count=0* (glob) | |
|
334 | 334 | |
|
335 | 335 | Check that running "forced" on a non-general delta repository does not corrupt it |
|
336 | 336 | --------------------------------------------------------------------------------- |
General Comments 0
You need to be logged in to leave comments.
Login now