changegroup: inline ellipsisdata()
authorGregory Szorc <gregory.szorc@gmail.com>
Thu, 02 Aug 2018 16:36:40 -0700
changeset 38892 eb022ce9e505
parent 38891 205c98e2f1ba
child 38893 23d582caae30
changegroup: inline ellipsisdata() There's only one caller of it. I don't think it needs to exist as a standalone function. Differential Revision: https://phab.mercurial-scm.org/D4074
mercurial/changegroup.py
--- a/mercurial/changegroup.py	Thu Aug 02 17:05:11 2018 -0700
+++ b/mercurial/changegroup.py	Thu Aug 02 16:36:40 2018 -0700
@@ -494,20 +494,6 @@
             return d
         return readexactly(self._fh, n)
 
-def ellipsisdata(packer, rev, revlog_, p1, p2, data, linknode):
-    n = revlog_.node(rev)
-    p1n, p2n = revlog_.node(p1), revlog_.node(p2)
-    flags = revlog_.flags(rev)
-    flags |= revlog.REVIDX_ELLIPSIS
-    meta = packer.builddeltaheader(
-        n, p1n, p2n, nullid, linknode, flags)
-    # TODO: try and actually send deltas for ellipsis data blocks
-    diffheader = mdiff.trivialdiffheader(len(data))
-    l = len(meta) + len(diffheader) + len(data)
-    return ''.join((chunkheader(l),
-                    meta,
-                    diffheader,
-                    data))
 
 class cg1packer(object):
     deltaheader = _CHANGEGROUPV1_DELTA_HEADER
@@ -1052,10 +1038,21 @@
             p2 = nullrev
         else:
             p1, p2 = sorted(local(p) for p in linkparents)
+
         n = store.node(rev)
-
-        yield ellipsisdata(
-            self, rev, store, p1, p2, store.revision(n), linknode)
+        p1n, p2n = store.node(p1), store.node(p2)
+        flags = store.flags(rev)
+        flags |= revlog.REVIDX_ELLIPSIS
+        meta = self.builddeltaheader(
+            n, p1n, p2n, nullid, linknode, flags)
+        # TODO: try and actually send deltas for ellipsis data blocks
+        data = store.revision(n)
+        diffheader = mdiff.trivialdiffheader(len(data))
+        l = len(meta) + len(diffheader) + len(data)
+        yield ''.join((chunkheader(l),
+                       meta,
+                       diffheader,
+                       data))
 
     def builddeltaheader(self, node, p1n, p2n, basenode, linknode, flags):
         # do nothing with basenode, it is implicitly the previous one in HG10