--- a/hgext/evolve.py Tue Sep 02 20:11:45 2014 +0200
+++ b/hgext/evolve.py Wed Sep 03 23:56:39 2014 +0200
@@ -2254,19 +2254,38 @@
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
- obsexcmsg(repo.ui, "computing relevant nodes\n")
- 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)
+if getattr(exchange, '_pushdiscoveryobsmarkers', None) is not None:
+ @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
+ obsexcmsg(repo.ui, "computing relevant nodes\n")
+ 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]
+ if nodes:
+ obsexcmsg(repo.ui, "computing markers relevant to %i nodes\n"
+ % len(nodes))
+ pushop.outobsmarkers = repo.obsstore.relevantmarkers(nodes)
+ else:
+ obsexcmsg(repo.ui, "markers already in sync\n")
+ pushop.outobsmarkers = []
+ 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]
if nodes:
obsexcmsg(repo.ui, "computing markers relevant to %i nodes\n"
@@ -2275,24 +2294,6 @@
else:
obsexcmsg(repo.ui, "markers already in sync\n")
pushop.outobsmarkers = []
- 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]
- if nodes:
- obsexcmsg(repo.ui, "computing markers relevant to %i nodes\n"
- % len(nodes))
- pushop.outobsmarkers = repo.obsstore.relevantmarkers(nodes)
- else:
- obsexcmsg(repo.ui, "markers already in sync\n")
- pushop.outobsmarkers = []
@eh.wrapfunction(wireproto, 'capabilities')
def discocapabilities(orig, repo, proto):
@@ -2311,10 +2312,14 @@
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
+ if getattr(exchange, '_pushdiscoveryobsmarkers', None) is None:
+ ui.warn('evolve: your mercurial version is too old\n'
+ 'evolve: (running in degraded mode, push will includes all markers)\n')
+ else:
+ olddisco = exchange.pushdiscoverymapping['obsmarker']
+ def newdisco(pushop):
+ _pushdiscoveryobsmarkers(olddisco, pushop)
+ exchange.pushdiscoverymapping['obsmarker'] = newdisco
### Set discovery START
@@ -2558,20 +2563,21 @@
kwargs['evo_obscommon'] = common
return ret
-@eh.wrapfunction(exchange, '_getbundleobsmarkerpart')
-def _getbundleobsmarkerpart(orig, bundler, repo, source, heads=None, common=None,
- bundlecaps=None, **kwargs):
- if 'evo_obscommon' not in kwargs:
- return orig(bundler, repo, source, heads, common, bundlecaps, **kwargs)
+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):
+ if 'evo_obscommon' not in kwargs:
+ return orig(bundler, repo, source, heads, common, bundlecaps, **kwargs)
- if kwargs.get('obsmarkers', False):
- if heads is None:
- heads = repo.heads()
- obscommon = kwargs.get('evo_obscommon', ())
- obsset = repo.set('::%ln - ::%ln', heads, obscommon)
- subset = [c.node() for c in obsset]
- markers = repo.obsstore.relevantmarkers(subset)
- exchange.buildobsmarkerspart(bundler, markers)
+ if kwargs.get('obsmarkers', False):
+ if heads is None:
+ heads = repo.heads()
+ obscommon = kwargs.get('evo_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.wrapfunction(exchange, '_pullobsolete')