changegroup: emit delta group close chunk outside of deltagroup()
authorGregory Szorc <gregory.szorc@gmail.com>
Wed, 08 Aug 2018 14:15:33 -0700
changeset 39048 fcdab6629dde
parent 39047 9e8eb2b444e5
child 39049 2ebdd265fe8c
changegroup: emit delta group close chunk outside of deltagroup() I want to make deltagroup() emit data structures rather than serialized deltas. Upcoming commits will demonstrate why. Differential Revision: https://phab.mercurial-scm.org/D4207
mercurial/changegroup.py
--- a/mercurial/changegroup.py	Wed Aug 08 14:19:02 2018 -0700
+++ b/mercurial/changegroup.py	Wed Aug 08 14:15:33 2018 -0700
@@ -700,7 +700,6 @@
     """
     # if we don't have any revisions touched by these changesets, bail
     if len(revs) == 0:
-        yield closechunk()
         return
 
     cl = repo.changelog
@@ -753,8 +752,6 @@
     if progress:
         progress.complete()
 
-    yield closechunk()
-
 class cgpacker(object):
     def __init__(self, repo, filematcher, version, allowreorder,
                  deltaparentfn, builddeltaheader, manifestsend,
@@ -839,6 +836,10 @@
             size += len(chunk)
             yield chunk
 
+        close = closechunk()
+        size += len(close)
+        yield closechunk()
+
         self._verbosenote(_('%8.i (changelog)\n') % size)
 
         clrevorder = clstate['clrevorder']
@@ -1067,6 +1068,10 @@
                 size += len(chunk)
                 yield chunk
 
+            close = closechunk()
+            size += len(close)
+            yield close
+
         self._verbosenote(_('%8.i (manifests)\n') % size)
         yield self._manifestsend
 
@@ -1165,6 +1170,11 @@
                 for chunk in it:
                     size += len(chunk)
                     yield chunk
+
+                close = closechunk()
+                size += len(close)
+                yield close
+
                 self._verbosenote(_('%8.i  %s\n') % (size, fname))
         progress.complete()