changegroup: inline _packmanifests() into generatemanifests()
authorGregory Szorc <gregory.szorc@gmail.com>
Tue, 07 Aug 2018 15:31:03 -0700
changeset 39006 5959ef78d834
parent 39005 d56a6b78de3b
child 39007 39f5c7afdc25
changegroup: inline _packmanifests() into generatemanifests() It is relatively small. Every other generate*() calls group() directly. So the new code is consistent. Differential Revision: https://phab.mercurial-scm.org/D4198
mercurial/changegroup.py
--- a/mercurial/changegroup.py	Tue Aug 07 15:13:25 2018 -0700
+++ b/mercurial/changegroup.py	Tue Aug 07 15:31:03 2018 -0700
@@ -834,22 +834,6 @@
         rr, rl = store.rev, store.linkrev
         return [n for n in missing if rl(rr(n)) not in commonrevs]
 
-    def _packmanifests(self, dir, dirlog, revs, lookuplinknode,
-                       clrevtolocalrev):
-        """Pack manifests into a changegroup stream.
-
-        Encodes the directory name in the output so multiple manifests
-        can be sent. Multiple manifests is not supported by cg1 and cg2.
-        """
-        if dir:
-            assert self.version == b'03'
-            yield _fileheader(dir)
-
-        for chunk in self.group(revs, dirlog, False, lookuplinknode,
-                                units=_('manifests'),
-                                clrevtolocalrev=clrevtolocalrev):
-            yield chunk
-
     def generate(self, commonrevs, clnodes, fastpathlinkrev, source):
         """Yield a sequence of changegroup byte chunks."""
 
@@ -1061,10 +1045,17 @@
                 revs = _sortnodesnormal(store, prunednodes,
                                         self._reorder)
 
-            for x in self._packmanifests(dir, store, revs, lookupfn,
-                                         clrevtolocalrev):
-                size += len(x)
-                yield x
+            if dir:
+                assert self.version == b'03'
+                chunk = _fileheader(dir)
+                size += len(chunk)
+                yield chunk
+
+            for chunk in self.group(revs, store, False, lookupfn,
+                                    units=_('manifests'),
+                                    clrevtolocalrev=clrevtolocalrev):
+                size += len(chunk)
+                yield chunk
 
         self._verbosenote(_('%8.i (manifests)\n') % size)
         yield self._manifestsend