diff hgext/simple4server.py @ 1272:749c931aa47b

merge with stable
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 20 Apr 2015 14:21:38 +0200
parents 4279ec5ff3a7 c52c15100fb2
children 5e82d78f5872
line wrap: on
line diff
--- a/hgext/simple4server.py	Sat Apr 11 00:10:10 2015 -0400
+++ b/hgext/simple4server.py	Mon Apr 20 14:21:38 2015 +0200
@@ -8,7 +8,7 @@
 For client side usages it is recommended to use the evolve extension for
 improved user interface.'''
 
-testedwith = '3.0.1'
+testedwith = '3.3.3 3.4-rc'
 buglink = 'https://bitbucket.org/marmoute/mutable-history/issues'
 
 import mercurial.obsolete
@@ -192,10 +192,6 @@
         ctx = unfi[i]
         entry = 0
         sha = util.sha1()
-        issue4587 = ctx.hex() == "195dbd1cef0c2f9f8bcf4ea303238105f716bda3"
-        if issue4587:
-            import sys
-            print >> sys.stderr, 'Witchcraft tracking: ON'
         # add data from p1
         for p in ctx.parents():
             p = p.rev()
@@ -206,9 +202,6 @@
             if p != node.nullid:
                 entry += 1
                 sha.update(p)
-                if issue4587:
-                    print >> sys.stderr, '  Parent: %r' % p
-                    print >> sys.stderr, '   Value: %s' % sha.hexdigest()
         tmarkers = repo.obsstore.relevantmarkers([ctx.node()])
         if tmarkers:
             bmarkers = []
@@ -220,16 +213,10 @@
             for m in bmarkers:
                 entry += 1
                 sha.update(m)
-                if issue4587:
-                    print >> sys.stderr, '  Marker: %r' % m
-                    print >> sys.stderr, '   Value: %s' % sha.hexdigest()
         if entry:
             cache.append((ctx.node(), sha.digest()))
         else:
             cache.append((ctx.node(), node.nullid))
-        if issue4587:
-            print >> sys.stderr, '   Final: %s' % sha.hexdigest()
-            print >> sys.stderr, 'Witchcraft tracking: OFF'
     return cache
 
 # from evolve extension: 3249814dabd1
@@ -265,10 +252,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:
@@ -294,6 +284,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']