diff mercurial/exchange.py @ 21062:e7c0a65a5c9c

bundle2: use headerless HG10UN stream in changegroup Using `readbundle` in the part handlers creates a circular import hell. We are now using a simple `HG10UN` stream with no header. Some parameters may later be introduced on the part to change parameter. Producers are updated as well.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 14 Apr 2014 14:46:32 -0400
parents 62d35f251c60
children 7ca4f2049d3b
line wrap: on
line diff
--- a/mercurial/exchange.py	Thu Apr 10 10:53:43 2014 -0700
+++ b/mercurial/exchange.py	Mon Apr 14 14:46:32 2014 -0400
@@ -109,6 +109,7 @@
                 if pushop.remote.capable('bundle2'):
                     _pushbundle2(pushop)
                 else:
+                    _pushchangeset(pushop)
             _pushcomputecommonheads(pushop)
             _pushsyncphase(pushop)
             _pushobsolete(pushop)
@@ -186,11 +187,7 @@
         bundler.addpart(part)
     # add the changegroup bundle
     cg = changegroup.getlocalbundle(pushop.repo, 'push', pushop.outgoing)
-    def cgchunks(cg=cg):
-        yield 'HG10UN'
-        for c in cg.getchunks():
-            yield c
-    cgpart = bundle2.bundlepart('CHANGEGROUP', data=cgchunks())
+    cgpart = bundle2.bundlepart('CHANGEGROUP', data=cg.getchunks())
     bundler.addpart(cgpart)
     stream = util.chunkbuffer(bundler.getchunks())
     sent = bundle2.unbundle20(pushop.repo.ui, stream)
@@ -634,11 +631,7 @@
     # very crude first implementation,
     # the bundle API will change and the generation will be done lazily.
     bundler = bundle2.bundle20(repo.ui)
-    def cgchunks(cg=cg):
-        yield 'HG10UN'
-        for c in cg.getchunks():
-            yield c
-    part = bundle2.bundlepart('changegroup', data=cgchunks())
+    part = bundle2.bundlepart('changegroup', data=cg.getchunks())
     bundler.addpart(part)
     return bundle2.unbundle20(repo.ui, util.chunkbuffer(bundler.getchunks()))