changeset 39165:860e83cd97de

setdiscovery: don't use dagutil to compute heads This is a relatively trivial operation to perform. We don't need to use dagutil. This brings us one step closer to eliminating dagutil. We still need to populate the heads on revlogdag because later functionality relies on it. Differential Revision: https://phab.mercurial-scm.org/D4310
author Gregory Szorc <gregory.szorc@gmail.com>
date Thu, 16 Aug 2018 20:23:10 +0000
parents 01ab7f656a10
children 484c9fe570a7
files mercurial/setdiscovery.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/setdiscovery.py	Thu Aug 16 20:11:45 2018 +0000
+++ b/mercurial/setdiscovery.py	Thu Aug 16 20:23:10 2018 +0000
@@ -144,16 +144,17 @@
     cl = local.changelog
     clnode = cl.node
     clrev = cl.rev
-    localsubset = None
 
     if ancestorsof is not None:
-        localsubset = [clrev(n) for n in ancestorsof]
-    dag = dagutil.revlogdag(cl, localsubset=localsubset)
+        ownheads = [clrev(n) for n in ancestorsof]
+    else:
+        ownheads = [rev for rev in cl.headrevs() if rev != nullrev]
+
+    dag = dagutil.revlogdag(cl, localsubset=ownheads)
 
     # early exit if we know all the specified remote heads already
     ui.debug("query 1; heads\n")
     roundtrips += 1
-    ownheads = dag.heads()
     sample = _limitsample(ownheads, initialsamplesize)
     # indices between sample and externalized version must match
     sample = list(sample)