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'.
--- 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)