hgext/evolve.py
changeset 1076 2039385d6460
parent 1075 1205f42ae54c
child 1077 cdfc19f25478
--- a/hgext/evolve.py	Wed Aug 27 12:05:49 2014 +0200
+++ b/hgext/evolve.py	Fri Aug 29 10:13:44 2014 +0200
@@ -2226,6 +2226,31 @@
         topic = 'OBSEXC'
     ui.progress(topic, *args, **kwargs)
 
+@eh.wrapfunction(exchange, '_pushdiscoveryobsmarkers')
+def _pushdiscoveryobsmarkers(orig, pushop):
+    if (obsolete._enabled
+        and pushop.repo.obsstore
+        and 'obsolete' in pushop.remote.listkeys('namespaces')):
+        repo = pushop.repo
+        revs = list(repo.revs('::%ln', pushop.futureheads))
+        unfi = repo.unfiltered()
+        cl = unfi.changelog
+        if not pushop.remote.capable('_evoext_obshash_0'):
+            # do not trust core yet
+            # return orig(pushop)
+            nodes = [cl.node(r) for r in revs]
+            pushop.outobsmarkers = repo.obsstore.relevantmarkers(nodes)
+            return
+
+        common = []
+        obsexcmsg(repo.ui, "looking for common markers in %i nodes\n"
+                           % len(revs))
+        commonrevs = list(unfi.revs('::%ln', pushop.outgoing.commonheads))
+        common = findcommonobsmarkers(pushop.ui, unfi, pushop.remote, commonrevs)
+
+        revs = list(unfi.revs('%ld - (::%ln)', revs, common))
+        nodes = [cl.node(r) for r in revs]
+        pushop.outobsmarkers = repo.obsstore.relevantmarkers(nodes)
 
 @eh.wrapfunction(wireproto, 'capabilities')
 def discocapabilities(orig, repo, proto):
@@ -2244,6 +2269,10 @@
         return discocapabilities(oldcap, repo, proto)
     wireproto.commands['capabilities'] = (newcap, args)
     wireproto.commands['evoext_obshash'] = (srv_obshash, 'nodes')
+    olddisco = exchange.pushdiscoverymapping['obsmarker']
+    def newdisco(pushop):
+        _pushdiscoveryobsmarkers(olddisco, pushop)
+    exchange.pushdiscoverymapping['obsmarker'] = newdisco
 
 ### Set discovery START