Mercurial > evolve
diff hgext/evolve.py @ 1076:2039385d6460
discovery: hook on the official discovery for obsmarker
This will let the discovery be done once and used by core.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Fri, 29 Aug 2014 10:13:44 +0200 |
parents | 1205f42ae54c |
children | cdfc19f25478 |
line wrap: on
line diff
--- 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