changegroup: remove dictionary creation from deltachunk
authorDurham Goode <durham@fb.com>
Wed, 20 Sep 2017 09:35:45 -0700
changeset 34294 05131c963767
parent 34293 0fe62d8bdd50
child 34295 3bb2a9f25fe9
changegroup: remove dictionary creation from deltachunk Previously delta chunk returned a dictionary. Now that we consume deltachunk within changegroup (instead of outside in revlog) we can just return a tuple and have it be returned directly by deltaiter. Differential Revision: https://phab.mercurial-scm.org/D746
mercurial/changegroup.py
--- a/mercurial/changegroup.py	Wed Sep 20 09:39:03 2017 -0700
+++ b/mercurial/changegroup.py	Wed Sep 20 09:35:45 2017 -0700
@@ -188,8 +188,7 @@
         header = struct.unpack(self.deltaheader, headerdata)
         delta = readexactly(self._stream, l - self.deltaheadersize)
         node, p1, p2, deltabase, cs, flags = self._deltaheader(header, prevnode)
-        return {'node': node, 'p1': p1, 'p2': p2, 'cs': cs,
-                'deltabase': deltabase, 'delta': delta, 'flags': flags}
+        return (node, p1, p2, cs, deltabase, delta, flags)
 
     def getchunks(self):
         """returns all the chunks contains in the bundle
@@ -438,17 +437,9 @@
         """
         chain = None
         for chunkdata in iter(lambda: self.deltachunk(chain), {}):
-            node = chunkdata['node']
-            p1 = chunkdata['p1']
-            p2 = chunkdata['p2']
-            cs = chunkdata['cs']
-            deltabase = chunkdata['deltabase']
-            delta = chunkdata['delta']
-            flags = chunkdata['flags']
-
-            chain = node
-
-            yield (node, p1, p2, cs, deltabase, delta, flags)
+            # Chunkdata: (node, p1, p2, cs, deltabase, delta, flags)
+            yield chunkdata
+            chain = chunkdata[0]
 
 class cg2unpacker(cg1unpacker):
     """Unpacker for cg2 streams.