changeset 39022:a3105433ecc4

changegroup: inline _revchunk() into group() _revchunk() was pretty minimal. I think having all the code for generating data composing the changegroup in one function makes things easier to understand. As part of the refactor, we now call the _revisiondelta* functions explicitly. This paves the road to refactor their argument signatures. Differential Revision: https://phab.mercurial-scm.org/D4141
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 06 Aug 2018 11:13:25 -0700
parents fbbda9ff3deb
children d85b0d81112b
files mercurial/changegroup.py
diffstat 1 files changed, 17 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/changegroup.py	Mon Aug 06 11:06:22 2018 -0700
+++ b/mercurial/changegroup.py	Mon Aug 06 11:13:25 2018 -0700
@@ -674,8 +674,23 @@
                 progress.update(r + 1)
             prev, curr = revs[r], revs[r + 1]
             linknode = lookup(store.node(curr))
-            for c in self._revchunk(store, ischangelog, curr, prev, linknode):
-                yield c
+
+            if self._ellipses:
+                delta = self._revisiondeltanarrow(store, ischangelog,
+                                                  curr, prev, linknode)
+            else:
+                delta = self._revisiondeltanormal(store, ischangelog,
+                                                  curr, prev, linknode)
+
+            if not delta:
+                continue
+
+            meta = self._builddeltaheader(delta)
+            l = len(meta) + sum(len(x) for x in delta.deltachunks)
+            yield chunkheader(l)
+            yield meta
+            for x in delta.deltachunks:
+                yield x
 
         if progress:
             progress.complete()
@@ -995,24 +1010,6 @@
                 self._verbosenote(_('%8.i  %s\n') % (size, fname))
         progress.complete()
 
-    def _revchunk(self, store, ischangelog, rev, prev, linknode):
-        if self._ellipses:
-            fn = self._revisiondeltanarrow
-        else:
-            fn = self._revisiondeltanormal
-
-        delta = fn(store, ischangelog, rev, prev, linknode)
-        if not delta:
-            return
-
-        meta = self._builddeltaheader(delta)
-        l = len(meta) + sum(len(x) for x in delta.deltachunks)
-
-        yield chunkheader(l)
-        yield meta
-        for x in delta.deltachunks:
-            yield x
-
     def _revisiondeltanormal(self, store, ischangelog, rev, prev, linknode):
         node = store.node(rev)
         p1, p2 = store.parentrevs(rev)