Mercurial > hg
changeset 51328:46415df4eb1c
delta-find: move filing of some debug data in `_one_dbg_data`
Since the `_one_dbg_data` method is meant to create a valid debug dictionnary.
We can as well prefill the relevant value to reduce the amount of debug code in
the main code.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 23 Nov 2023 03:23:41 +0100 |
parents | a4af7507fa4b |
children | 398a105b16a0 |
files | mercurial/revlogutils/deltas.py |
diffstat | 1 files changed, 16 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revlogutils/deltas.py Thu Nov 23 01:28:30 2023 +0100 +++ b/mercurial/revlogutils/deltas.py Thu Nov 23 03:23:41 2023 +0100 @@ -1313,20 +1313,6 @@ start = util.timer() dbg = self._one_dbg_data() dbg['revision'] = target_rev - target_revlog = b"UNKNOWN" - target_type = self.revlog.target[0] - target_key = self.revlog.target[1] - if target_type == KIND_CHANGELOG: - target_revlog = b'CHANGELOG:' - elif target_type == KIND_MANIFESTLOG: - target_revlog = b'MANIFESTLOG:' - if target_key: - target_revlog += b'%s:' % target_key - elif target_type == KIND_FILELOG: - target_revlog = b'FILELOG:' - if target_key: - target_revlog += b'%s:' % target_key - dbg['target-revlog'] = target_revlog p1r = revlog.rev(revinfo.p1) p2r = revlog.rev(revinfo.p2) if p1r != nullrev: @@ -1599,7 +1585,7 @@ return deltainfo def _one_dbg_data(self): - return { + dbg = { 'duration': None, 'revision': None, 'delta-base': None, @@ -1612,6 +1598,21 @@ 'snapshot-depth': None, 'target-revlog': None, } + target_revlog = b"UNKNOWN" + target_type = self.revlog.target[0] + target_key = self.revlog.target[1] + if target_type == KIND_CHANGELOG: + target_revlog = b'CHANGELOG:' + elif target_type == KIND_MANIFESTLOG: + target_revlog = b'MANIFESTLOG:' + if target_key: + target_revlog += b'%s:' % target_key + elif target_type == KIND_FILELOG: + target_revlog = b'FILELOG:' + if target_key: + target_revlog += b'%s:' % target_key + dbg['target-revlog'] = target_revlog + return dbg def _dbg_process_data(self, dbg): if self._debug_info is not None: