Mercurial > public > mercurial-scm > hg
comparison mercurial/revlogutils/deltas.py @ 50648:d1dc4a03125e stable
delta-find: intrduce a `_one_dbg_data` method
This helps with the initialisation of the expected debug information.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 08 Jun 2023 02:35:03 +0200 |
parents | 4d84b6d52e93 |
children | ebb292ffdf4d |
comparison
equal
deleted
inserted
replaced
50647:4d84b6d52e93 | 50648:d1dc4a03125e |
---|---|
1435 cachedelta is not None | 1435 cachedelta is not None |
1436 and dbg_try_rounds == 1 | 1436 and dbg_try_rounds == 1 |
1437 and dbg_try_count == 1 | 1437 and dbg_try_count == 1 |
1438 and deltainfo.base == cachedelta[0] | 1438 and deltainfo.base == cachedelta[0] |
1439 ) | 1439 ) |
1440 dbg = { | 1440 dbg = self._one_dbg_data() |
1441 'duration': end - start, | 1441 dbg['duration'] = end - start |
1442 'revision': target_rev, | 1442 dbg['revision'] = target_rev |
1443 'delta-base': deltainfo.base, # pytype: disable=attribute-error | 1443 dbg[ |
1444 'search_round_count': dbg_try_rounds, | 1444 'delta-base' |
1445 'using-cached-base': used_cached, | 1445 ] = deltainfo.base # pytype: disable=attribute-error |
1446 'delta_try_count': dbg_try_count, | 1446 dbg['search_round_count'] = dbg_try_rounds |
1447 'type': dbg_type, | 1447 dbg['using-cached-base'] = used_cached |
1448 'p1-chain-len': p1_chain_len, | 1448 dbg['delta_try_count'] = dbg_try_count |
1449 'p2-chain-len': p2_chain_len, | 1449 dbg['type'] = dbg_type |
1450 } | 1450 dbg['p1-chain-len'] = p1_chain_len |
1451 dbg['p2-chain-len'] = p2_chain_len | |
1451 if ( | 1452 if ( |
1452 deltainfo.snapshotdepth # pytype: disable=attribute-error | 1453 deltainfo.snapshotdepth # pytype: disable=attribute-error |
1453 is not None | 1454 is not None |
1454 ): | 1455 ): |
1455 dbg[ | 1456 dbg[ |
1471 if target_key: | 1472 if target_key: |
1472 target_revlog += b'%s:' % target_key | 1473 target_revlog += b'%s:' % target_key |
1473 dbg['target-revlog'] = target_revlog | 1474 dbg['target-revlog'] = target_revlog |
1474 self._dbg_process_data(dbg) | 1475 self._dbg_process_data(dbg) |
1475 return deltainfo | 1476 return deltainfo |
1477 | |
1478 def _one_dbg_data(self): | |
1479 return { | |
1480 'duration': None, | |
1481 'revision': None, | |
1482 'delta-base': None, | |
1483 'search_round_count': None, | |
1484 'using-cached-base': None, | |
1485 'delta_try_count': None, | |
1486 'type': None, | |
1487 'p1-chain-len': None, | |
1488 'p2-chain-len': None, | |
1489 'snapshot-depth': None, | |
1490 'target-revlog': None, | |
1491 } | |
1476 | 1492 |
1477 def _dbg_process_data(self, dbg): | 1493 def _dbg_process_data(self, dbg): |
1478 if self._debug_info is not None: | 1494 if self._debug_info is not None: |
1479 self._debug_info.append(dbg) | 1495 self._debug_info.append(dbg) |
1480 | 1496 |