Patchwork D7843: nodemap: move the iteratio inside the Block object

login
register
mail settings
Submitter phabricator
Date Jan. 31, 2020, 3:29 p.m.
Message ID <40532797f4ffb5998e97b5d040a50101@localhost.localdomain>
Download mbox | patch
Permalink /patch/44807/
State Not Applicable
Headers show

Comments

phabricator - Jan. 31, 2020, 3:29 p.m.
marmoute updated this revision to Diff 19759.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7843?vs=19297&id=19759

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

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

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
@@ -220,7 +220,8 @@ 
 
     contains up to 16 entry indexed from 0 to 15"""
 
-    pass
+    def __iter__(self):
+        return iter(self.get(i) for i in range(16))
 
 
 def _build_trie(index):
@@ -295,7 +296,7 @@ 
     Children block are assumed to be already persisted and present in
     block_map.
     """
-    data = tuple(_to_value(block_node.get(i), block_map) for i in range(16))
+    data = tuple(_to_value(v, block_map) for v in block_node)
     return S_BLOCK.pack(*data)