comparison mercurial/revlogutils/deltas.py @ 50379:4d84b6d52e93 stable

delta-find: move final debug processing in a `_dbg_process_data` method This will help us making sure we can call the necessary debugging code in alternative codepath.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 08 Jun 2023 01:52:35 +0200
parents c84cc0ac77e4
children d1dc4a03125e
comparison
equal deleted inserted replaced
50378:c84cc0ac77e4 50379:4d84b6d52e93
1469 elif target_type == KIND_FILELOG: 1469 elif target_type == KIND_FILELOG:
1470 target_revlog = b'FILELOG:' 1470 target_revlog = b'FILELOG:'
1471 if target_key: 1471 if target_key:
1472 target_revlog += b'%s:' % target_key 1472 target_revlog += b'%s:' % target_key
1473 dbg['target-revlog'] = target_revlog 1473 dbg['target-revlog'] = target_revlog
1474 1474 self._dbg_process_data(dbg)
1475 if self._debug_info is not None:
1476 self._debug_info.append(dbg)
1477
1478 if self._write_debug is not None:
1479 msg = (
1480 b"DBG-DELTAS:"
1481 b" %-12s"
1482 b" rev=%d:"
1483 b" delta-base=%d"
1484 b" is-cached=%d"
1485 b" - search-rounds=%d"
1486 b" try-count=%d"
1487 b" - delta-type=%-6s"
1488 b" snap-depth=%d"
1489 b" - p1-chain-length=%d"
1490 b" p2-chain-length=%d"
1491 b" - duration=%f"
1492 b"\n"
1493 )
1494 msg %= (
1495 dbg["target-revlog"],
1496 dbg["revision"],
1497 dbg["delta-base"],
1498 dbg["using-cached-base"],
1499 dbg["search_round_count"],
1500 dbg["delta_try_count"],
1501 dbg["type"],
1502 dbg["snapshot-depth"],
1503 dbg["p1-chain-len"],
1504 dbg["p2-chain-len"],
1505 dbg["duration"],
1506 )
1507 self._write_debug(msg)
1508 return deltainfo 1475 return deltainfo
1476
1477 def _dbg_process_data(self, dbg):
1478 if self._debug_info is not None:
1479 self._debug_info.append(dbg)
1480
1481 if self._write_debug is not None:
1482 msg = (
1483 b"DBG-DELTAS:"
1484 b" %-12s"
1485 b" rev=%d:"
1486 b" delta-base=%d"
1487 b" is-cached=%d"
1488 b" - search-rounds=%d"
1489 b" try-count=%d"
1490 b" - delta-type=%-6s"
1491 b" snap-depth=%d"
1492 b" - p1-chain-length=%d"
1493 b" p2-chain-length=%d"
1494 b" - duration=%f"
1495 b"\n"
1496 )
1497 msg %= (
1498 dbg["target-revlog"],
1499 dbg["revision"],
1500 dbg["delta-base"],
1501 dbg["using-cached-base"],
1502 dbg["search_round_count"],
1503 dbg["delta_try_count"],
1504 dbg["type"],
1505 dbg["snapshot-depth"],
1506 dbg["p1-chain-len"],
1507 dbg["p2-chain-len"],
1508 dbg["duration"],
1509 )
1510 self._write_debug(msg)
1509 1511
1510 1512
1511 def delta_compression(default_compression_header, deltainfo): 1513 def delta_compression(default_compression_header, deltainfo):
1512 """return (COMPRESSION_MODE, deltainfo) 1514 """return (COMPRESSION_MODE, deltainfo)
1513 1515