# HG changeset patch # User Pierre-Yves David # Date 1496147740 -7200 # Node ID b9f03002f214c345f193aad6e1f823c02311e9cf # Parent 333de672c7f0968036fe3c81d6b5280eae3d2c2d obsdiscovery: extract push-obshashtree discovery in a function This will help use to simplify the code. diff -r 333de672c7f0 -r b9f03002f214 hgext3rd/evolve/obsdiscovery.py --- a/hgext3rd/evolve/obsdiscovery.py Tue May 30 14:27:26 2017 +0200 +++ b/hgext3rd/evolve/obsdiscovery.py Tue May 30 14:35:40 2017 +0200 @@ -857,6 +857,14 @@ missing += pushop.outgoing.missing return missing +def _pushobshashtree(pushop, commonrevs): + repo = pushop.repo.unfiltered() + remote = pushop.remote + node = repo.changelog.node + common = findcommonobsmarkers(pushop.ui, repo, remote, commonrevs) + revs = list(repo.revs('only(%ln, %ln)', pushop.futureheads, common)) + return [node(r) for r in revs] + @eh.wrapfunction(exchange, '_pushdiscoveryobsmarkers') def _pushdiscoveryobsmarkers(orig, pushop): if _dopushmarkers(pushop): @@ -864,21 +872,16 @@ obsexcmsg(repo.ui, "computing relevant nodes\n") revs = list(repo.revs('::%ln', pushop.futureheads)) unfi = repo.unfiltered() - cl = unfi.changelog if not _canobshashtree(repo, pushop.remote): return orig(pushop) - common = [] 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): nodes = _pushobshashrange(pushop, commonrevs) else: - common = findcommonobsmarkers(pushop.ui, unfi, pushop.remote, - commonrevs) - revs = list(unfi.revs('only(%ln, %ln)', pushop.futureheads, common)) - nodes = [cl.node(r) for r in revs] + nodes = _pushobshashtree(pushop, commonrevs) if nodes: obsexcmsg(repo.ui, "computing markers relevant to %i nodes\n"