changeset 1253:d03583da89c4 stable

pull: fix bundle2 part generation The new part generator (allowing partial pull) was unproperly installed.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 20 Apr 2015 13:36:12 +0200
parents d001376b0c09
children 87d626390270
files hgext/evolve.py hgext/simple4server.py
diffstat 2 files changed, 22 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/evolve.py	Sat Apr 11 10:35:26 2015 -0400
+++ b/hgext/evolve.py	Mon Apr 20 13:36:12 2015 +0200
@@ -2642,20 +2642,28 @@
 
 if getattr(exchange, '_getbundleobsmarkerpart', None) is not None:
     @eh.wrapfunction(exchange, '_getbundleobsmarkerpart')
-    def _getbundleobsmarkerpart(orig, bundler, repo, source, heads=None, common=None,
-                                bundlecaps=None, **kwargs):
+    def _getbundleobsmarkerpart(orig, bundler, repo, source, **kwargs):
         if 'evo_obscommon' not in kwargs:
-            return orig(bundler, repo, source, heads, common, bundlecaps, **kwargs)
-
+            return orig(bundler, repo, source, **kwargs)
+
+        heads = kwargs.get('heads')
         if kwargs.get('obsmarkers', False):
             if heads is None:
                 heads = repo.heads()
             obscommon = kwargs.get('evo_obscommon', ())
+            assert obscommon
             obsset = repo.set('::%ln - ::%ln', heads, obscommon)
             subset = [c.node() for c in obsset]
             markers = repo.obsstore.relevantmarkers(subset)
             exchange.buildobsmarkerspart(bundler, markers)
 
+    @eh.uisetup
+    def installgetbundlepartgen(ui):
+        origfunc = exchange.getbundle2partsmapping['obsmarkers']
+        def newfunc(*args, **kwargs):
+            return _getbundleobsmarkerpart(origfunc, *args, **kwargs)
+        exchange.getbundle2partsmapping['obsmarkers'] = newfunc
+
 
 @eh.wrapfunction(exchange, '_pullobsolete')
 def _pullobsolete(orig, pullop):
--- a/hgext/simple4server.py	Sat Apr 11 10:35:26 2015 -0400
+++ b/hgext/simple4server.py	Mon Apr 20 13:36:12 2015 +0200
@@ -255,10 +255,13 @@
         caps += ' _evoext_getbundle_obscommon'
     return caps
 
-def _getbundleobsmarkerpart(orig, bundler, repo, source, heads=None, common=None,
-                            bundlecaps=None, **kwargs):
+def _getbundleobsmarkerpart(orig, bundler, repo, source, **kwargs):
     if 'evo_obscommon' not in kwargs:
-        return orig(bundler, repo, source, heads, common, bundlecaps, **kwargs)
+        return orig(bundler, repo, source, **kwargs)
+
+    heads = kwargs.get('heads')
+    if 'evo_obscommon' not in kwargs:
+        return orig(bundler, repo, source, **kwargs)
 
     if kwargs.get('obsmarkers', False):
         if heads is None:
@@ -284,6 +287,10 @@
     wireproto.commands['evoext_pullobsmarkers_0'] = (srv_pullobsmarkers, '*')
     # wrap module content
     extensions.wrapfunction(exchange, '_pullbundle2extraprepare', _getbundleobsmarkerpart)
+    origfunc = exchange.getbundle2partsmapping['obsmarkers']
+    def newfunc(*args, **kwargs):
+        return _getbundleobsmarkerpart(origfunc, *args, **kwargs)
+    exchange.getbundle2partsmapping['obsmarkers'] = newfunc
     extensions.wrapfunction(wireproto, 'capabilities', capabilities)
     # wrap command content
     oldcap, args = wireproto.commands['capabilities']