mercurial/changegroup.py
changeset 38922 ee1ea96cf9c9
parent 38874 a232e6744ba3
child 38923 a2f521773761
--- a/mercurial/changegroup.py	Sun Jul 22 19:48:50 2018 +0900
+++ b/mercurial/changegroup.py	Sat Jul 28 17:52:21 2018 -0700
@@ -14,6 +14,7 @@
 from .i18n import _
 from .node import (
     hex,
+    nullid,
     nullrev,
     short,
 )
@@ -27,6 +28,7 @@
     phases,
     pycompat,
     repository,
+    revlog,
     util,
 )
 
@@ -492,6 +494,21 @@
             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
     version = '01'