changeset 957:2cde59f3cb5d

evolve: add a push pass using bundle2 Instead of using a dedicated wireprotocol commands, we use bundle2 to transmit an obs marker parts. This aims at both testing bundle2 more and to limit the amount of special code we needs to put in simple for server to fit our needs. The massive test changes comes from the fact we can use this fast path for both remote and local push.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 20 May 2014 13:41:27 -0700
parents b107f3549ec2
children 6d18a1ab496c
files README hgext/evolve.py tests/test-corrupt.t tests/test-exchange-A1.t tests/test-exchange-A2.t tests/test-exchange-A3.t tests/test-exchange-A4.t tests/test-exchange-A5.t tests/test-exchange-A6.t tests/test-exchange-B1.t tests/test-exchange-B2.t tests/test-exchange-B4.t tests/test-exchange-B5.t tests/test-exchange-B6.t tests/test-exchange-C1.t tests/test-exchange-C2.t tests/test-exchange-C3.t tests/test-exchange-C4.t tests/test-exchange-D1.t tests/test-exchange-D2.t tests/test-exchange-D4.t tests/test-obsolete.t tests/test-tutorial.t
diffstat 23 files changed, 68 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/README	Mon Jun 02 14:44:13 2014 -0700
+++ b/README	Tue May 20 13:41:27 2014 -0700
@@ -64,6 +64,7 @@
     - added progress when pulling obsmarkers
     - only pull markers relevant to pulled subset
     - avoid exchanging common markers in some case
+    - use bundle2 as transport when available.
  - add a hook related to the new commands
 
 3.3.2 -- 2014-05-14
--- a/hgext/evolve.py	Mon Jun 02 14:44:13 2014 -0700
+++ b/hgext/evolve.py	Tue May 20 13:41:27 2014 -0700
@@ -66,6 +66,7 @@
 from mercurial import wireproto
 from mercurial import localrepo
 from mercurial.hgweb import hgweb_mod
+from mercurial import bundle2
 
 _pack = struct.pack
 
@@ -2275,6 +2276,26 @@
             markers = []
         if not markers:
             repo.ui.status("OBSEXC: no marker to push\n")
+        elif remote.capable('_evoext_b2x_obsmarkers_0_pushonly'):
+            obsdata = StringIO()
+            _encodemarkersstream(obsdata, markers)
+            obsdata.seek(0)
+            repo.ui.status("OBSEXC: pushing %i markers (%i bytes)\n"
+                           % (len(markers), len(obsdata.getvalue())))
+            bundler = bundle2.bundle20(pushop.ui, {})
+            capsblob = bundle2.encodecaps(pushop.repo.bundle2caps)
+            bundler.addpart(bundle2.bundlepart('b2x:replycaps', data=capsblob))
+            cgpart = bundle2.bundlepart('EVOLVE:B2X:OBSMARKERV1', data=obsdata.getvalue())
+            bundler.addpart(cgpart)
+            stream = util.chunkbuffer(bundler.getchunks())
+            try:
+                reply = pushop.remote.unbundle(stream, ['force'], 'push')
+            except bundle2.UnknownPartError, exc:
+                raise util.Abort('missing support for %s' % exc)
+            try:
+                op = bundle2.processbundle(pushop.repo, reply)
+            except bundle2.UnknownPartError, exc:
+                raise util.Abort('missing support for %s' % exc)
         elif remote.capable('_evoext_pushobsmarkers_0'):
             obsdata = pushobsmarkerStringIO()
             _encodemarkersstream(obsdata, markers)
@@ -2348,6 +2369,12 @@
     repo.hook('evolve_pushobsmarkers')
     return wireproto.pushres(0)
 
+@bundle2.parthandler('evolve:b2x:obsmarkerv1')
+def handleobsmarkerv1(op, inpart):
+    """add a stream of obsmarker to the repo"""
+    tr = op.gettransaction()
+    op.repo.obsstore.mergemarkers(tr, inpart.read())
+
 def _buildpullobsmerkersboundaries(pullop):
     """small funtion returning the argument for pull markers call
     may to contains 'heads' and 'common'. skip the key for None.
@@ -2582,12 +2609,14 @@
         caps += ' _evoext_pushobsmarkers_0'
         caps += ' _evoext_pullobsmarkers_0'
         caps += ' _evoext_obshash_0'
+        caps += ' _evoext_b2x_obsmarkers_0_pushonly'
     return caps
 
 
 @eh.extsetup
 def _installwireprotocol(ui):
     localrepo.moderncaps.add('_evoext_pullobsmarkers_0')
+    localrepo.moderncaps.add('_evoext_b2x_obsmarkers_0_pushonly')
     hgweb_mod.perms['evoext_pushobsmarkers_0'] = 'push'
     hgweb_mod.perms['evoext_pullobsmarkers_0'] = 'pull'
     hgweb_mod.perms['evoext_obshash'] = 'pull'
--- a/tests/test-corrupt.t	Mon Jun 02 14:44:13 2014 -0700
+++ b/tests/test-corrupt.t	Tue May 20 13:41:27 2014 -0700
@@ -113,7 +113,7 @@
   added 1 changesets with 2 changes to 2 files
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 4 nodes
-  OBSEXC: pushing 2 markers in 1 pushkey payload (184 bytes)
+  OBSEXC: pushing 2 markers (147 bytes)
   OBSEXC: DONE
   $ hg -R ../other verify
   checking changesets
--- a/tests/test-exchange-A1.t	Mon Jun 02 14:44:13 2014 -0700
+++ b/tests/test-exchange-A1.t	Tue May 20 13:41:27 2014 -0700
@@ -74,7 +74,7 @@
   added 1 changesets with 1 changes to 1 files
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 2 nodes
-  OBSEXC: pushing 1 markers in 1 pushkey payload (78 bytes)
+  OBSEXC: pushing 1 markers (62 bytes)
   OBSEXC: DONE
   ## post push state
   # obstore: main
@@ -124,7 +124,7 @@
   added 1 changesets with 1 changes to 1 files
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 2 nodes
-  OBSEXC: pushing 1 markers in 1 pushkey payload (78 bytes)
+  OBSEXC: pushing 1 markers (62 bytes)
   OBSEXC: DONE
   ## post push state
   # obstore: main
@@ -233,7 +233,7 @@
   added 2 changesets with 2 changes to 2 files
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 3 nodes
-  OBSEXC: pushing 1 markers in 1 pushkey payload (78 bytes)
+  OBSEXC: pushing 1 markers (62 bytes)
   OBSEXC: DONE
   ## post push state
   # obstore: main
@@ -280,7 +280,7 @@
   added 2 changesets with 2 changes to 2 files
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 3 nodes
-  OBSEXC: pushing 1 markers in 1 pushkey payload (78 bytes)
+  OBSEXC: pushing 1 markers (62 bytes)
   OBSEXC: DONE
   ## post push state
   # obstore: main
--- a/tests/test-exchange-A2.t	Mon Jun 02 14:44:13 2014 -0700
+++ b/tests/test-exchange-A2.t	Tue May 20 13:41:27 2014 -0700
@@ -82,7 +82,7 @@
   added 1 changesets with 1 changes to 1 files
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 2 nodes
-  OBSEXC: pushing 1 markers in 1 pushkey payload (78 bytes)
+  OBSEXC: pushing 1 markers (62 bytes)
   OBSEXC: DONE
   ## post push state
   # obstore: main
--- a/tests/test-exchange-A3.t	Mon Jun 02 14:44:13 2014 -0700
+++ b/tests/test-exchange-A3.t	Tue May 20 13:41:27 2014 -0700
@@ -94,7 +94,7 @@
   added 1 changesets with 1 changes to 1 files
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 2 nodes
-  OBSEXC: pushing 1 markers in 1 pushkey payload (78 bytes)
+  OBSEXC: pushing 1 markers (62 bytes)
   OBSEXC: DONE
   ## post push state
   # obstore: main
@@ -198,7 +198,7 @@
   added 1 changesets with 1 changes to 1 files (+1 heads)
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 2 nodes
-  OBSEXC: pushing 1 markers in 1 pushkey payload (78 bytes)
+  OBSEXC: pushing 1 markers (62 bytes)
   OBSEXC: DONE
   ## post push state
   # obstore: main
--- a/tests/test-exchange-A4.t	Mon Jun 02 14:44:13 2014 -0700
+++ b/tests/test-exchange-A4.t	Tue May 20 13:41:27 2014 -0700
@@ -87,7 +87,7 @@
   added 2 changesets with 2 changes to 2 files
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 3 nodes
-  OBSEXC: pushing 1 markers in 1 pushkey payload (78 bytes)
+  OBSEXC: pushing 1 markers (62 bytes)
   OBSEXC: DONE
   ## post push state
   # obstore: main
--- a/tests/test-exchange-A5.t	Mon Jun 02 14:44:13 2014 -0700
+++ b/tests/test-exchange-A5.t	Tue May 20 13:41:27 2014 -0700
@@ -95,7 +95,7 @@
   added 1 changesets with 1 changes to 1 files
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 2 nodes
-  OBSEXC: pushing 1 markers in 1 pushkey payload (78 bytes)
+  OBSEXC: pushing 1 markers (62 bytes)
   OBSEXC: DONE
   ## post push state
   # obstore: main
--- a/tests/test-exchange-A6.t	Mon Jun 02 14:44:13 2014 -0700
+++ b/tests/test-exchange-A6.t	Tue May 20 13:41:27 2014 -0700
@@ -82,7 +82,7 @@
   no changes found
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 2 nodes
-  OBSEXC: pushing 1 markers in 1 pushkey payload (78 bytes)
+  OBSEXC: pushing 1 markers (62 bytes)
   OBSEXC: DONE
   ## post push state
   # obstore: main
@@ -121,7 +121,7 @@
   no changes found
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 3 nodes
-  OBSEXC: pushing 1 markers in 1 pushkey payload (78 bytes)
+  OBSEXC: pushing 1 markers (62 bytes)
   OBSEXC: DONE
   ## post push state
   # obstore: main
--- a/tests/test-exchange-B1.t	Mon Jun 02 14:44:13 2014 -0700
+++ b/tests/test-exchange-B1.t	Tue May 20 13:41:27 2014 -0700
@@ -73,7 +73,7 @@
   added 1 changesets with 1 changes to 1 files
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 2 nodes
-  OBSEXC: pushing 1 markers in 1 pushkey payload (112 bytes)
+  OBSEXC: pushing 1 markers (89 bytes)
   OBSEXC: DONE
   ## post push state
   # obstore: main
@@ -120,7 +120,7 @@
   added 1 changesets with 1 changes to 1 files
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 2 nodes
-  OBSEXC: pushing 1 markers in 1 pushkey payload (112 bytes)
+  OBSEXC: pushing 1 markers (89 bytes)
   OBSEXC: DONE
   ## post push state
   # obstore: main
--- a/tests/test-exchange-B2.t	Mon Jun 02 14:44:13 2014 -0700
+++ b/tests/test-exchange-B2.t	Tue May 20 13:41:27 2014 -0700
@@ -65,7 +65,7 @@
   no changes found
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 1 nodes
-  OBSEXC: pushing 1 markers in 1 pushkey payload (112 bytes)
+  OBSEXC: pushing 1 markers (89 bytes)
   OBSEXC: DONE
   ## post push state
   # obstore: main
@@ -104,7 +104,7 @@
   no changes found
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 1 nodes
-  OBSEXC: pushing 1 markers in 1 pushkey payload (112 bytes)
+  OBSEXC: pushing 1 markers (89 bytes)
   OBSEXC: DONE
   ## post push state
   # obstore: main
--- a/tests/test-exchange-B4.t	Mon Jun 02 14:44:13 2014 -0700
+++ b/tests/test-exchange-B4.t	Tue May 20 13:41:27 2014 -0700
@@ -91,7 +91,7 @@
   no changes found
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 1 nodes
-  OBSEXC: pushing 1 markers in 1 pushkey payload (112 bytes)
+  OBSEXC: pushing 1 markers (89 bytes)
   OBSEXC: DONE
   ## post push state
   # obstore: main
@@ -130,7 +130,7 @@
   no changes found
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 3 nodes
-  OBSEXC: pushing 1 markers in 1 pushkey payload (112 bytes)
+  OBSEXC: pushing 1 markers (89 bytes)
   OBSEXC: DONE
   ## post push state
   # obstore: main
--- a/tests/test-exchange-B5.t	Mon Jun 02 14:44:13 2014 -0700
+++ b/tests/test-exchange-B5.t	Tue May 20 13:41:27 2014 -0700
@@ -93,7 +93,7 @@
   added 2 changesets with 2 changes to 2 files
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 3 nodes
-  OBSEXC: pushing 2 markers in 1 pushkey payload (188 bytes)
+  OBSEXC: pushing 2 markers (150 bytes)
   OBSEXC: DONE
   ## post push state
   # obstore: main
@@ -148,7 +148,7 @@
   added 2 changesets with 2 changes to 2 files
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 3 nodes
-  OBSEXC: pushing 2 markers in 1 pushkey payload (188 bytes)
+  OBSEXC: pushing 2 markers (150 bytes)
   OBSEXC: DONE
   ## post push state
   # obstore: main
--- a/tests/test-exchange-B6.t	Mon Jun 02 14:44:13 2014 -0700
+++ b/tests/test-exchange-B6.t	Tue May 20 13:41:27 2014 -0700
@@ -77,7 +77,7 @@
   no changes found
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 1 nodes
-  OBSEXC: pushing 2 markers in 1 pushkey payload (188 bytes)
+  OBSEXC: pushing 2 markers (150 bytes)
   OBSEXC: DONE
   ## post push state
   # obstore: main
--- a/tests/test-exchange-C1.t	Mon Jun 02 14:44:13 2014 -0700
+++ b/tests/test-exchange-C1.t	Tue May 20 13:41:27 2014 -0700
@@ -72,7 +72,7 @@
   no changes found
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 1 nodes
-  OBSEXC: pushing 2 markers in 1 pushkey payload (222 bytes)
+  OBSEXC: pushing 2 markers (177 bytes)
   OBSEXC: DONE
   ## post push state
   # obstore: main
@@ -117,7 +117,7 @@
   no changes found
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 1 nodes
-  OBSEXC: pushing 2 markers in 1 pushkey payload (222 bytes)
+  OBSEXC: pushing 2 markers (177 bytes)
   OBSEXC: DONE
   ## post push state
   # obstore: main
--- a/tests/test-exchange-C2.t	Mon Jun 02 14:44:13 2014 -0700
+++ b/tests/test-exchange-C2.t	Tue May 20 13:41:27 2014 -0700
@@ -82,7 +82,7 @@
   added 1 changesets with 1 changes to 1 files
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 2 nodes
-  OBSEXC: pushing 2 markers in 1 pushkey payload (188 bytes)
+  OBSEXC: pushing 2 markers (150 bytes)
   OBSEXC: DONE
   ## post push state
   # obstore: main
@@ -135,7 +135,7 @@
   added 1 changesets with 1 changes to 1 files
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 2 nodes
-  OBSEXC: pushing 2 markers in 1 pushkey payload (188 bytes)
+  OBSEXC: pushing 2 markers (150 bytes)
   OBSEXC: DONE
   ## post push state
   # obstore: main
--- a/tests/test-exchange-C3.t	Mon Jun 02 14:44:13 2014 -0700
+++ b/tests/test-exchange-C3.t	Tue May 20 13:41:27 2014 -0700
@@ -85,7 +85,7 @@
   no changes found
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 1 nodes
-  OBSEXC: pushing 3 markers in 1 pushkey payload (298 bytes)
+  OBSEXC: pushing 3 markers (238 bytes)
   OBSEXC: DONE
   ## post push state
   # obstore: main
@@ -136,7 +136,7 @@
   no changes found
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 1 nodes
-  OBSEXC: pushing 3 markers in 1 pushkey payload (298 bytes)
+  OBSEXC: pushing 3 markers (238 bytes)
   OBSEXC: DONE
   ## post push state
   # obstore: main
--- a/tests/test-exchange-C4.t	Mon Jun 02 14:44:13 2014 -0700
+++ b/tests/test-exchange-C4.t	Tue May 20 13:41:27 2014 -0700
@@ -93,7 +93,7 @@
   no changes found
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 1 nodes
-  OBSEXC: pushing 2 markers in 1 pushkey payload (188 bytes)
+  OBSEXC: pushing 2 markers (150 bytes)
   OBSEXC: DONE
   ## post push state
   # obstore: main
--- a/tests/test-exchange-D1.t	Mon Jun 02 14:44:13 2014 -0700
+++ b/tests/test-exchange-D1.t	Tue May 20 13:41:27 2014 -0700
@@ -76,7 +76,7 @@
   added 1 changesets with 1 changes to 1 files
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 2 nodes
-  OBSEXC: pushing 2 markers in 1 pushkey payload (188 bytes)
+  OBSEXC: pushing 2 markers (150 bytes)
   OBSEXC: DONE
   ## post push state
   # obstore: main
--- a/tests/test-exchange-D2.t	Mon Jun 02 14:44:13 2014 -0700
+++ b/tests/test-exchange-D2.t	Tue May 20 13:41:27 2014 -0700
@@ -69,7 +69,7 @@
   no changes found
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 1 nodes
-  OBSEXC: pushing 2 markers in 1 pushkey payload (188 bytes)
+  OBSEXC: pushing 2 markers (150 bytes)
   OBSEXC: DONE
   ## post push state
   # obstore: main
--- a/tests/test-exchange-D4.t	Mon Jun 02 14:44:13 2014 -0700
+++ b/tests/test-exchange-D4.t	Tue May 20 13:41:27 2014 -0700
@@ -92,7 +92,7 @@
   added 1 changesets with 1 changes to 1 files
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 2 nodes
-  OBSEXC: pushing 2 markers in 1 pushkey payload (154 bytes)
+  OBSEXC: pushing 2 markers (123 bytes)
   OBSEXC: DONE
   ## post push state
   # obstore: main
--- a/tests/test-obsolete.t	Mon Jun 02 14:44:13 2014 -0700
+++ b/tests/test-obsolete.t	Tue May 20 13:41:27 2014 -0700
@@ -183,7 +183,7 @@
   added 5 changesets with 5 changes to 5 files (+1 heads)
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 5 nodes
-  OBSEXC: pushing 2 markers in 1 pushkey payload (154 bytes)
+  OBSEXC: pushing 2 markers (123 bytes)
   OBSEXC: DONE
   $ hg -R ../other-new verify
   checking changesets
@@ -240,7 +240,7 @@
   added 1 changesets with 1 changes to 1 files (+1 heads)
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 5 nodes
-  OBSEXC: pushing 3 markers in 1 pushkey payload (230 bytes)
+  OBSEXC: pushing 3 markers (184 bytes)
   OBSEXC: DONE
   $ qlog -R ../other-new
   5
@@ -265,7 +265,7 @@
   no changes found
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 5 nodes
-  OBSEXC: pushing 3 markers in 1 pushkey payload (230 bytes)
+  OBSEXC: pushing 3 markers (184 bytes)
   OBSEXC: DONE
   [1]
 
@@ -548,7 +548,7 @@
   added 2 changesets with 1 changes to [12] files (re)
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 5 nodes
-  OBSEXC: pushing 7 markers in 1 pushkey payload (565 bytes)
+  OBSEXC: pushing 7 markers (452 bytes)
   OBSEXC: DONE
   $ hg up -q 10
   $ mkcommit "obsol_d'''"
@@ -563,7 +563,7 @@
   added 1 changesets with 1 changes to 1 files (+1 heads)
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 5 nodes
-  OBSEXC: pushing 8 markers in 1 pushkey payload (642 bytes)
+  OBSEXC: pushing 8 markers (513 bytes)
   OBSEXC: DONE
   $ cd ..
 
--- a/tests/test-tutorial.t	Mon Jun 02 14:44:13 2014 -0700
+++ b/tests/test-tutorial.t	Tue May 20 13:41:27 2014 -0700
@@ -407,7 +407,7 @@
   added 3 changesets with 3 changes to 1 files
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 5 nodes
-  OBSEXC: pushing 6 markers in 1 pushkey payload (609 bytes)
+  OBSEXC: pushing 6 markers (487 bytes)
   OBSEXC: DONE
 
 for simplicity sake we get the bathroom change in line again
@@ -740,7 +740,7 @@
   added 2 changesets with 2 changes to 1 files (+1 heads)
   OBSEXC: computing relevant nodes
   OBSEXC: computing markers relevant to 7 nodes
-  OBSEXC: pushing 10 markers in 1 pushkey payload (1004 bytes)
+  OBSEXC: pushing 10 markers (803 bytes)
   OBSEXC: DONE
 
 remote get a warning that current working directory is based on an obsolete changeset