Patchwork D7883: nodemap: keep track of the ondisk id of nodemap blocks

login
register
mail settings
Submitter phabricator
Date Feb. 2, 2020, 8:19 a.m.
Message ID <e13de400216c97b18a10633c1032a297@localhost.localdomain>
Download mbox | patch
Permalink /patch/44883/
State Not Applicable
Headers show

Comments

phabricator - Feb. 2, 2020, 8:19 a.m.
marmoute added a comment.
marmoute updated this revision to Diff 19836.


  small doc update on .#s[1]

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7883?vs=19792&id=19836

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7883/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7883

AFFECTED FILES
  mercurial/revlogutils/nodemap.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/revlogutils/nodemap.py b/mercurial/revlogutils/nodemap.py
--- a/mercurial/revlogutils/nodemap.py
+++ b/mercurial/revlogutils/nodemap.py
@@ -221,6 +221,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))
 
@@ -329,8 +334,8 @@ 
     """Parse the persisted version 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: