# HG changeset patch # User Pierre-Yves David # Date 1496146870 -7200 # Node ID 0e6ae8db9c21f082667ba9bd1a15415bb7e837db # Parent 4c0b10d73f5fa51f5d73a8a7261ba05ecd6bd24e obsdiscovery: extract push-obshashrange discovery in a function This will help us to simplify the code. The code is updated to directly use 'outgoing' missing so that is no longer needs to access 'futureheads'. diff -r 4c0b10d73f5f -r 0e6ae8db9c21 hgext3rd/evolve/obsdiscovery.py --- a/hgext3rd/evolve/obsdiscovery.py Tue May 30 14:09:06 2017 +0200 +++ b/hgext3rd/evolve/obsdiscovery.py Tue May 30 14:21:10 2017 +0200 @@ -850,6 +850,13 @@ # remote server accept markers and 'obsolete' in pushop.remote.listkeys('namespaces')) +def _pushobshashrange(pushop, commonrevs): + repo = pushop.repo.unfiltered() + remote = pushop.remote + missing = findmissingrange(pushop.ui, repo, remote, commonrevs) + missing += pushop.outgoing.missing + return missing + @eh.wrapfunction(exchange, '_pushdiscoveryobsmarkers') def _pushdiscoveryobsmarkers(orig, pushop): if _dopushmarkers(pushop): @@ -862,17 +869,11 @@ return orig(pushop) common = [] - missing = None obsexcmsg(repo.ui, "looking for common markers in %i nodes\n" % len(revs)) commonrevs = list(unfi.revs('::%ln', pushop.outgoing.commonheads)) if _canobshashrange(repo, pushop.remote): - missing = findmissingrange(pushop.ui, unfi, pushop.remote, - commonrevs) - revs = list(repo.revs('only(%ln, %ln)', pushop.futureheads, - pushop.outgoing.commonheads)) - nodes = [cl.node(r) for r in revs] - nodes += missing + nodes = _pushobshashrange(pushop, commonrevs) else: common = findcommonobsmarkers(pushop.ui, unfi, pushop.remote, commonrevs)