diff mercurial/exchange.py @ 23177:706547a14b8b

changegroup: introduce "raw" versions of some commands The commands getchangegroup, getlocalchangegroup and getsubset now each have a version ending in -raw. The raw versions return the chunk generator from the changegroup packer directly, without wrapping it in a chunkbuffer and unpacker. This avoids extra chunkbuffers in the bundle2 code path. Also, the raw versions can be extended to support alternative packers in the future, to be used from bundle2.
author Sune Foldager <cryo@cyanite.org>
date Fri, 17 Oct 2014 14:41:02 +0200
parents e53f6b72a0e4
children 6bb9533fa8fa
line wrap: on
line diff
--- a/mercurial/exchange.py	Tue Nov 04 16:43:33 2014 -0600
+++ b/mercurial/exchange.py	Fri Oct 17 14:41:02 2014 +0200
@@ -445,8 +445,9 @@
                                      pushop.outgoing)
     if not pushop.force:
         bundler.newpart('B2X:CHECK:HEADS', data=iter(pushop.remoteheads))
-    cg = changegroup.getlocalchangegroup(pushop.repo, 'push', pushop.outgoing)
-    cgpart = bundler.newpart('B2X:CHANGEGROUP', data=cg.getchunks())
+    cg = changegroup.getlocalchangegroupraw(pushop.repo, 'push',
+                                            pushop.outgoing)
+    cgpart = bundler.newpart('B2X:CHANGEGROUP', data=cg)
     def handlereply(op):
         """extract addchangegroup returns from server reply"""
         cgreplies = op.records.getreplies(cgpart.id)
@@ -1185,11 +1186,11 @@
     cg = None
     if kwargs.get('cg', True):
         # build changegroup bundle here.
-        cg = changegroup.getchangegroup(repo, source, heads=heads,
-                                        common=common, bundlecaps=bundlecaps)
+        cg = changegroup.getchangegroupraw(repo, source, heads=heads,
+                                           common=common, bundlecaps=bundlecaps)
 
     if cg:
-        bundler.newpart('b2x:changegroup', data=cg.getchunks())
+        bundler.newpart('b2x:changegroup', data=cg)
 
 @getbundle2partsgenerator('listkeys')
 def _getbundlelistkeysparts(bundler, repo, source, bundlecaps=None,