D7843: nodemap: move the iteratio inside the Block object

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

D7843: nodemap: move the iteratio inside the Block object

martinvonz (Martin von Zweigbergk)
marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

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

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/revlogutils/nodemap.py

CHANGE DETAILS

diff --git a/mercurial/revlogutils/nodemap.py b/mercurial/revlogutils/nodemap.py
--- a/mercurial/revlogutils/nodemap.py
+++ b/mercurial/revlogutils/nodemap.py
@@ -219,7 +219,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):
@@ -297,7 +298,7 @@
     Children block are assumed to be already serialized 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)
 
 



To: marmoute, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D7843: nodemap: move the iteratio inside the Block object

martinvonz (Martin von Zweigbergk)
marmoute updated this revision to Diff 19297.

REPOSITORY
  rHG Mercurial

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

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

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):
@@ -298,7 +299,7 @@
     Children block are assumed to be already serialized 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)
 
 



To: marmoute, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D7843: nodemap: move the iteratio inside the Block object

martinvonz (Martin von Zweigbergk)
In reply to this post by martinvonz (Martin von Zweigbergk)
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

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)
 
 



To: marmoute, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D7843: nodemap: move the iteratio inside the Block object

martinvonz (Martin von Zweigbergk)
In reply to this post by martinvonz (Martin von Zweigbergk)
marmoute updated this revision to Diff 19788.

REPOSITORY
  rHG Mercurial

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

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

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):
@@ -296,7 +297,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)
 
 



To: marmoute, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D7843: nodemap: move the iteratio inside the Block object

martinvonz (Martin von Zweigbergk)
In reply to this post by martinvonz (Martin von Zweigbergk)
marmoute added a comment.
marmoute updated this revision to Diff 19832.


  small doc update on .#s[1]

REPOSITORY
  rHG Mercurial

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

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

diff --git a/mercurial/revlogutils/nodemap.py b/mercurial/revlogutils/nodemap.py
--- a/mercurial/revlogutils/nodemap.py
+++ b/mercurial/revlogutils/nodemap.py
@@ -221,7 +221,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):
@@ -297,7 +298,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)
 
 



To: marmoute, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D7843: nodemap: move the iteratio inside the Block object

martinvonz (Martin von Zweigbergk)
In reply to this post by martinvonz (Martin von Zweigbergk)
marmoute added a comment.
marmoute updated this revision to Diff 19891.


  rebase to latest default

REPOSITORY
  rHG Mercurial

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

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

diff --git a/mercurial/revlogutils/nodemap.py b/mercurial/revlogutils/nodemap.py
--- a/mercurial/revlogutils/nodemap.py
+++ b/mercurial/revlogutils/nodemap.py
@@ -221,7 +221,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):
@@ -297,7 +298,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)
 
 



To: marmoute, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D7843: nodemap: move the iteratio inside the Block object

martinvonz (Martin von Zweigbergk)
In reply to this post by martinvonz (Martin von Zweigbergk)
Closed by commit rHG55b12f2593c1: nodemap: move the iteratio inside the Block object (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D7843?vs=19891&id=20111#toc

REPOSITORY
  rHG Mercurial

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

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

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,9 @@
 
     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 @@
     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)
 
 



To: marmoute, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel