indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  _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.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/changegroup.py

CHANGE DETAILS

diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -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)



To: indygreg, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to