From patchwork Wed Jan 15 14:55:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D7883: nodemap: keep track of the ondisk id of nodemap blocks From: phabricator X-Patchwork-Id: 44372 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Wed, 15 Jan 2020 14:55:29 +0000 marmoute created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY If we are to incrementally update the files, we need to keep some details about the data we read. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D7883 AFFECTED FILES mercurial/revlogutils/nodemap.py CHANGE DETAILS To: marmoute, #hg-reviewers Cc: mercurial-devel diff --git a/mercurial/revlogutils/nodemap.py b/mercurial/revlogutils/nodemap.py --- a/mercurial/revlogutils/nodemap.py +++ b/mercurial/revlogutils/nodemap.py @@ -220,6 +220,11 @@ contains up to 16 entry indexed from 0 to 15""" + def __init__(self): + super(Block, self).__init__() + # If this block exist on disk, here is its ID + self.ondisk_id = None + def __iter__(self): return iter(self.get(i) for i in range(16)) @@ -330,8 +335,8 @@ """Parse the serialization of an individual block """ block = Block() - ondisk_id = len(block_map) - block_map[ondisk_id] = block + block.ondisk_id = len(block_map) + block_map[block.ondisk_id] = block values = S_BLOCK.unpack(block_data) for idx, v in enumerate(values): if v == NO_ENTRY: