changeset 34292:311f6ccf8f23

debug: update debugbundle to use new deltaiter api Changegroup now has a deltaiter api for easy iteration over a series of deltas. Let's use that in the debugbundle command. Differential Revision: https://phab.mercurial-scm.org/D744
author Durham Goode <durham@fb.com>
date Wed, 20 Sep 2017 09:28:30 -0700
parents 1db9abf407c5
children 0fe62d8bdd50
files mercurial/debugcommands.py
diffstat 1 files changed, 4 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Wed Sep 20 09:22:22 2017 -0700
+++ b/mercurial/debugcommands.py	Wed Sep 20 09:28:30 2017 -0700
@@ -263,18 +263,11 @@
 
         def showchunks(named):
             ui.write("\n%s%s\n" % (indent_string, named))
-            chain = None
-            for chunkdata in iter(lambda: gen.deltachunk(chain), {}):
-                node = chunkdata['node']
-                p1 = chunkdata['p1']
-                p2 = chunkdata['p2']
-                cs = chunkdata['cs']
-                deltabase = chunkdata['deltabase']
-                delta = chunkdata['delta']
+            for deltadata in gen.deltaiter():
+                node, p1, p2, cs, deltabase, delta, flags = deltadata
                 ui.write("%s%s %s %s %s %s %s\n" %
                          (indent_string, hex(node), hex(p1), hex(p2),
                           hex(cs), hex(deltabase), len(delta)))
-                chain = node
 
         chunkdata = gen.changelogheader()
         showchunks("changelog")
@@ -287,11 +280,9 @@
         if isinstance(gen, bundle2.unbundle20):
             raise error.Abort(_('use debugbundle2 for this file'))
         chunkdata = gen.changelogheader()
-        chain = None
-        for chunkdata in iter(lambda: gen.deltachunk(chain), {}):
-            node = chunkdata['node']
+        for deltadata in gen.deltaiter():
+            node, p1, p2, cs, deltabase, delta, flags = deltadata
             ui.write("%s%s\n" % (indent_string, hex(node)))
-            chain = node
 
 def _debugobsmarkers(ui, part, indent=0, **opts):
     """display version and markers contained in 'data'"""