changeset 21070:408877d491fb

bundle2: feed a binary stream to `peer.unbundle` This input will have to travel over the wire anyway, so we feed the peer method with a simple binary stream and rely on the server side to use `readbundle` to create the python object. The test output changes because the bundle is created marginally sooner and the debug output interleaves in a different way.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 15 Apr 2014 16:42:52 -0400
parents 0a9cae236738
children 19b9f23a8c6f
files mercurial/exchange.py mercurial/localrepo.py tests/test-acl.t
diffstat 3 files changed, 29 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/exchange.py	Tue Apr 15 15:20:33 2014 -0400
+++ b/mercurial/exchange.py	Tue Apr 15 16:42:52 2014 -0400
@@ -216,8 +216,7 @@
     cgpart = bundle2.bundlepart('CHANGEGROUP', data=cg.getchunks())
     bundler.addpart(cgpart)
     stream = util.chunkbuffer(bundler.getchunks())
-    sent = bundle2.unbundle20(pushop.repo.ui, stream)
-    reply = pushop.remote.unbundle(sent, ['force'], 'push')
+    reply = pushop.remote.unbundle(stream, ['force'], 'push')
     try:
         op = bundle2.processbundle(pushop.repo, reply)
     except KeyError, exc:
--- a/mercurial/localrepo.py	Tue Apr 15 15:20:33 2014 -0400
+++ b/mercurial/localrepo.py	Tue Apr 15 16:42:52 2014 -0400
@@ -123,6 +123,7 @@
 
         This function handles the repo locking itself."""
         try:
+            cg = exchange.readbundle(self.ui, cg, None)
             return exchange.unbundle(self._repo, cg, heads, 'push', url)
         except exchange.PushRaced, exc:
             raise error.ResponseError(_('push failed:'), exc.message)
--- a/tests/test-acl.t	Tue Apr 15 15:20:33 2014 -0400
+++ b/tests/test-acl.t	Tue Apr 15 16:42:52 2014 -0400
@@ -88,7 +88,6 @@
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
-  adding changesets
   bundling: 1/3 changesets (33.33%)
   bundling: 2/3 changesets (66.67%)
   bundling: 3/3 changesets (100.00%)
@@ -98,6 +97,7 @@
   bundling: foo/Bar/file.txt 1/3 files (33.33%)
   bundling: foo/file.txt 2/3 files (66.67%)
   bundling: quux/file.py 3/3 files (100.00%)
+  adding changesets
   changesets: 1 chunks
   add changeset ef1ea85a6374
   changesets: 2 chunks
@@ -147,7 +147,6 @@
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
-  adding changesets
   bundling: 1/3 changesets (33.33%)
   bundling: 2/3 changesets (66.67%)
   bundling: 3/3 changesets (100.00%)
@@ -157,6 +156,7 @@
   bundling: foo/Bar/file.txt 1/3 files (33.33%)
   bundling: foo/file.txt 2/3 files (66.67%)
   bundling: quux/file.py 3/3 files (100.00%)
+  adding changesets
   changesets: 1 chunks
   add changeset ef1ea85a6374
   changesets: 2 chunks
@@ -209,7 +209,6 @@
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
-  adding changesets
   bundling: 1/3 changesets (33.33%)
   bundling: 2/3 changesets (66.67%)
   bundling: 3/3 changesets (100.00%)
@@ -219,6 +218,7 @@
   bundling: foo/Bar/file.txt 1/3 files (33.33%)
   bundling: foo/file.txt 2/3 files (66.67%)
   bundling: quux/file.py 3/3 files (100.00%)
+  adding changesets
   changesets: 1 chunks
   add changeset ef1ea85a6374
   changesets: 2 chunks
@@ -281,7 +281,6 @@
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
-  adding changesets
   bundling: 1/3 changesets (33.33%)
   bundling: 2/3 changesets (66.67%)
   bundling: 3/3 changesets (100.00%)
@@ -291,6 +290,7 @@
   bundling: foo/Bar/file.txt 1/3 files (33.33%)
   bundling: foo/file.txt 2/3 files (66.67%)
   bundling: quux/file.py 3/3 files (100.00%)
+  adding changesets
   changesets: 1 chunks
   add changeset ef1ea85a6374
   changesets: 2 chunks
@@ -348,7 +348,6 @@
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
-  adding changesets
   bundling: 1/3 changesets (33.33%)
   bundling: 2/3 changesets (66.67%)
   bundling: 3/3 changesets (100.00%)
@@ -358,6 +357,7 @@
   bundling: foo/Bar/file.txt 1/3 files (33.33%)
   bundling: foo/file.txt 2/3 files (66.67%)
   bundling: quux/file.py 3/3 files (100.00%)
+  adding changesets
   changesets: 1 chunks
   add changeset ef1ea85a6374
   changesets: 2 chunks
@@ -420,7 +420,6 @@
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
-  adding changesets
   bundling: 1/3 changesets (33.33%)
   bundling: 2/3 changesets (66.67%)
   bundling: 3/3 changesets (100.00%)
@@ -430,6 +429,7 @@
   bundling: foo/Bar/file.txt 1/3 files (33.33%)
   bundling: foo/file.txt 2/3 files (66.67%)
   bundling: quux/file.py 3/3 files (100.00%)
+  adding changesets
   changesets: 1 chunks
   add changeset ef1ea85a6374
   changesets: 2 chunks
@@ -489,7 +489,6 @@
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
-  adding changesets
   bundling: 1/3 changesets (33.33%)
   bundling: 2/3 changesets (66.67%)
   bundling: 3/3 changesets (100.00%)
@@ -499,6 +498,7 @@
   bundling: foo/Bar/file.txt 1/3 files (33.33%)
   bundling: foo/file.txt 2/3 files (66.67%)
   bundling: quux/file.py 3/3 files (100.00%)
+  adding changesets
   changesets: 1 chunks
   add changeset ef1ea85a6374
   changesets: 2 chunks
@@ -563,7 +563,6 @@
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
-  adding changesets
   bundling: 1/3 changesets (33.33%)
   bundling: 2/3 changesets (66.67%)
   bundling: 3/3 changesets (100.00%)
@@ -573,6 +572,7 @@
   bundling: foo/Bar/file.txt 1/3 files (33.33%)
   bundling: foo/file.txt 2/3 files (66.67%)
   bundling: quux/file.py 3/3 files (100.00%)
+  adding changesets
   changesets: 1 chunks
   add changeset ef1ea85a6374
   changesets: 2 chunks
@@ -634,7 +634,6 @@
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
-  adding changesets
   bundling: 1/3 changesets (33.33%)
   bundling: 2/3 changesets (66.67%)
   bundling: 3/3 changesets (100.00%)
@@ -644,6 +643,7 @@
   bundling: foo/Bar/file.txt 1/3 files (33.33%)
   bundling: foo/file.txt 2/3 files (66.67%)
   bundling: quux/file.py 3/3 files (100.00%)
+  adding changesets
   changesets: 1 chunks
   add changeset ef1ea85a6374
   changesets: 2 chunks
@@ -707,7 +707,6 @@
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
-  adding changesets
   bundling: 1/3 changesets (33.33%)
   bundling: 2/3 changesets (66.67%)
   bundling: 3/3 changesets (100.00%)
@@ -717,6 +716,7 @@
   bundling: foo/Bar/file.txt 1/3 files (33.33%)
   bundling: foo/file.txt 2/3 files (66.67%)
   bundling: quux/file.py 3/3 files (100.00%)
+  adding changesets
   changesets: 1 chunks
   add changeset ef1ea85a6374
   changesets: 2 chunks
@@ -786,7 +786,6 @@
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
-  adding changesets
   bundling: 1/3 changesets (33.33%)
   bundling: 2/3 changesets (66.67%)
   bundling: 3/3 changesets (100.00%)
@@ -796,6 +795,7 @@
   bundling: foo/Bar/file.txt 1/3 files (33.33%)
   bundling: foo/file.txt 2/3 files (66.67%)
   bundling: quux/file.py 3/3 files (100.00%)
+  adding changesets
   changesets: 1 chunks
   add changeset ef1ea85a6374
   changesets: 2 chunks
@@ -866,7 +866,6 @@
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
-  adding changesets
   bundling: 1/3 changesets (33.33%)
   bundling: 2/3 changesets (66.67%)
   bundling: 3/3 changesets (100.00%)
@@ -876,6 +875,7 @@
   bundling: foo/Bar/file.txt 1/3 files (33.33%)
   bundling: foo/file.txt 2/3 files (66.67%)
   bundling: quux/file.py 3/3 files (100.00%)
+  adding changesets
   changesets: 1 chunks
   add changeset ef1ea85a6374
   changesets: 2 chunks
@@ -941,7 +941,6 @@
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
-  adding changesets
   bundling: 1/3 changesets (33.33%)
   bundling: 2/3 changesets (66.67%)
   bundling: 3/3 changesets (100.00%)
@@ -951,6 +950,7 @@
   bundling: foo/Bar/file.txt 1/3 files (33.33%)
   bundling: foo/file.txt 2/3 files (66.67%)
   bundling: quux/file.py 3/3 files (100.00%)
+  adding changesets
   changesets: 1 chunks
   add changeset ef1ea85a6374
   changesets: 2 chunks
@@ -1027,7 +1027,6 @@
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
-  adding changesets
   bundling: 1/3 changesets (33.33%)
   bundling: 2/3 changesets (66.67%)
   bundling: 3/3 changesets (100.00%)
@@ -1037,6 +1036,7 @@
   bundling: foo/Bar/file.txt 1/3 files (33.33%)
   bundling: foo/file.txt 2/3 files (66.67%)
   bundling: quux/file.py 3/3 files (100.00%)
+  adding changesets
   changesets: 1 chunks
   add changeset ef1ea85a6374
   changesets: 2 chunks
@@ -1107,7 +1107,6 @@
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
-  adding changesets
   bundling: 1/3 changesets (33.33%)
   bundling: 2/3 changesets (66.67%)
   bundling: 3/3 changesets (100.00%)
@@ -1117,6 +1116,7 @@
   bundling: foo/Bar/file.txt 1/3 files (33.33%)
   bundling: foo/file.txt 2/3 files (66.67%)
   bundling: quux/file.py 3/3 files (100.00%)
+  adding changesets
   changesets: 1 chunks
   add changeset ef1ea85a6374
   changesets: 2 chunks
@@ -1183,7 +1183,6 @@
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
-  adding changesets
   bundling: 1/3 changesets (33.33%)
   bundling: 2/3 changesets (66.67%)
   bundling: 3/3 changesets (100.00%)
@@ -1193,6 +1192,7 @@
   bundling: foo/Bar/file.txt 1/3 files (33.33%)
   bundling: foo/file.txt 2/3 files (66.67%)
   bundling: quux/file.py 3/3 files (100.00%)
+  adding changesets
   changesets: 1 chunks
   add changeset ef1ea85a6374
   changesets: 2 chunks
@@ -1259,7 +1259,6 @@
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
-  adding changesets
   bundling: 1/3 changesets (33.33%)
   bundling: 2/3 changesets (66.67%)
   bundling: 3/3 changesets (100.00%)
@@ -1269,6 +1268,7 @@
   bundling: foo/Bar/file.txt 1/3 files (33.33%)
   bundling: foo/file.txt 2/3 files (66.67%)
   bundling: quux/file.py 3/3 files (100.00%)
+  adding changesets
   changesets: 1 chunks
   add changeset ef1ea85a6374
   changesets: 2 chunks
@@ -1336,7 +1336,6 @@
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
-  adding changesets
   bundling: 1/3 changesets (33.33%)
   bundling: 2/3 changesets (66.67%)
   bundling: 3/3 changesets (100.00%)
@@ -1346,6 +1345,7 @@
   bundling: foo/Bar/file.txt 1/3 files (33.33%)
   bundling: foo/file.txt 2/3 files (66.67%)
   bundling: quux/file.py 3/3 files (100.00%)
+  adding changesets
   changesets: 1 chunks
   add changeset ef1ea85a6374
   changesets: 2 chunks
@@ -1451,7 +1451,6 @@
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
   e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
-  adding changesets
   bundling: 1/4 changesets (25.00%)
   bundling: 2/4 changesets (50.00%)
   bundling: 3/4 changesets (75.00%)
@@ -1464,6 +1463,7 @@
   bundling: foo/Bar/file.txt 2/4 files (50.00%)
   bundling: foo/file.txt 3/4 files (75.00%)
   bundling: quux/file.py 4/4 files (100.00%)
+  adding changesets
   changesets: 1 chunks
   add changeset ef1ea85a6374
   changesets: 2 chunks
@@ -1534,7 +1534,6 @@
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
   e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
-  adding changesets
   bundling: 1/4 changesets (25.00%)
   bundling: 2/4 changesets (50.00%)
   bundling: 3/4 changesets (75.00%)
@@ -1547,6 +1546,7 @@
   bundling: foo/Bar/file.txt 2/4 files (50.00%)
   bundling: foo/file.txt 3/4 files (75.00%)
   bundling: quux/file.py 4/4 files (100.00%)
+  adding changesets
   changesets: 1 chunks
   add changeset ef1ea85a6374
   changesets: 2 chunks
@@ -1613,7 +1613,6 @@
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
   e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
-  adding changesets
   bundling: 1/4 changesets (25.00%)
   bundling: 2/4 changesets (50.00%)
   bundling: 3/4 changesets (75.00%)
@@ -1626,6 +1625,7 @@
   bundling: foo/Bar/file.txt 2/4 files (50.00%)
   bundling: foo/file.txt 3/4 files (75.00%)
   bundling: quux/file.py 4/4 files (100.00%)
+  adding changesets
   changesets: 1 chunks
   add changeset ef1ea85a6374
   changesets: 2 chunks
@@ -1688,7 +1688,6 @@
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
   e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
-  adding changesets
   bundling: 1/4 changesets (25.00%)
   bundling: 2/4 changesets (50.00%)
   bundling: 3/4 changesets (75.00%)
@@ -1701,6 +1700,7 @@
   bundling: foo/Bar/file.txt 2/4 files (50.00%)
   bundling: foo/file.txt 3/4 files (75.00%)
   bundling: quux/file.py 4/4 files (100.00%)
+  adding changesets
   changesets: 1 chunks
   add changeset ef1ea85a6374
   changesets: 2 chunks
@@ -1757,7 +1757,6 @@
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
   e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
-  adding changesets
   bundling: 1/4 changesets (25.00%)
   bundling: 2/4 changesets (50.00%)
   bundling: 3/4 changesets (75.00%)
@@ -1770,6 +1769,7 @@
   bundling: foo/Bar/file.txt 2/4 files (50.00%)
   bundling: foo/file.txt 3/4 files (75.00%)
   bundling: quux/file.py 4/4 files (100.00%)
+  adding changesets
   changesets: 1 chunks
   add changeset ef1ea85a6374
   changesets: 2 chunks
@@ -1845,7 +1845,6 @@
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
   e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
-  adding changesets
   bundling: 1/4 changesets (25.00%)
   bundling: 2/4 changesets (50.00%)
   bundling: 3/4 changesets (75.00%)
@@ -1858,6 +1857,7 @@
   bundling: foo/Bar/file.txt 2/4 files (50.00%)
   bundling: foo/file.txt 3/4 files (75.00%)
   bundling: quux/file.py 4/4 files (100.00%)
+  adding changesets
   changesets: 1 chunks
   add changeset ef1ea85a6374
   changesets: 2 chunks
@@ -1932,7 +1932,6 @@
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
   e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
-  adding changesets
   bundling: 1/4 changesets (25.00%)
   bundling: 2/4 changesets (50.00%)
   bundling: 3/4 changesets (75.00%)
@@ -1945,6 +1944,7 @@
   bundling: foo/Bar/file.txt 2/4 files (50.00%)
   bundling: foo/file.txt 3/4 files (75.00%)
   bundling: quux/file.py 4/4 files (100.00%)
+  adding changesets
   changesets: 1 chunks
   add changeset ef1ea85a6374
   changesets: 2 chunks
@@ -2006,7 +2006,6 @@
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
   e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
-  adding changesets
   bundling: 1/4 changesets (25.00%)
   bundling: 2/4 changesets (50.00%)
   bundling: 3/4 changesets (75.00%)
@@ -2019,6 +2018,7 @@
   bundling: foo/Bar/file.txt 2/4 files (50.00%)
   bundling: foo/file.txt 3/4 files (75.00%)
   bundling: quux/file.py 4/4 files (100.00%)
+  adding changesets
   changesets: 1 chunks
   add changeset ef1ea85a6374
   changesets: 2 chunks
@@ -2087,7 +2087,6 @@
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
   e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
-  adding changesets
   bundling: 1/4 changesets (25.00%)
   bundling: 2/4 changesets (50.00%)
   bundling: 3/4 changesets (75.00%)
@@ -2100,6 +2099,7 @@
   bundling: foo/Bar/file.txt 2/4 files (50.00%)
   bundling: foo/file.txt 3/4 files (75.00%)
   bundling: quux/file.py 4/4 files (100.00%)
+  adding changesets
   changesets: 1 chunks
   add changeset ef1ea85a6374
   changesets: 2 chunks