Commit 55b12f2593c by Pierre-Yves David

nodemap: move the iteratio inside the Block object

Having the iteration inside the serialization function does not help
readability. Now that we have a `Block` object, let us move that code there.

Differential Revision: https://phab.mercurial-scm.org/D7843
parent 7762a295fd4
......@@ -221,6 +221,9 @@ class Block(dict):
contains up to 16 entry indexed from 0 to 15"""
def __iter__(self):
return iter(self.get(i) for i in range(16))
def _build_trie(index):
"""build a nodemap trie
......@@ -295,7 +298,7 @@ def _persist_block(block_node, block_map):
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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment