Mercurial > evolve
changeset 2514:b9f03002f214
obsdiscovery: extract push-obshashtree discovery in a function
This will help use to simplify the code.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 30 May 2017 14:35:40 +0200 |
parents | 333de672c7f0 |
children | cd8aa99d4f20 |
files | hgext3rd/evolve/obsdiscovery.py |
diffstat | 1 files changed, 9 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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"