setdiscovery: use revset for resolving DAG heads in a subset
authorGregory Szorc <gregory.szorc@gmail.com>
Fri, 17 Aug 2018 18:23:47 +0000
changeset 39176 fec01c69b0f0
parent 39175 bbb855c412c6
child 39177 4cf3f54cc8e7
setdiscovery: use revset for resolving DAG heads in a subset This was the final use of dagutil in setdiscovery! For reasons I didn't investigate, feeding a set with nullrev into the heads() revset resulted in a bunch of tests failing. Filtering out nullrev from the input set fixes things. Differential Revision: https://phab.mercurial-scm.org/D4324
mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py	Fri Aug 17 19:12:25 2018 +0000
+++ b/mercurial/setdiscovery.py	Fri Aug 17 18:23:47 2018 +0000
@@ -51,7 +51,6 @@
     nullrev,
 )
 from . import (
-    dagutil,
     error,
     util,
 )
@@ -158,8 +157,6 @@
     else:
         ownheads = [rev for rev in cl.headrevs() if rev != nullrev]
 
-    dag = dagutil.revlogdag(cl)
-
     # early exit if we know all the specified remote heads already
     ui.debug("query 1; heads\n")
     roundtrips += 1
@@ -273,10 +270,8 @@
 
     # heads(common) == heads(common.bases) since common represents common.bases
     # and all its ancestors
-    result = dag.headsetofconnecteds(common.bases)
-    # common.bases can include nullrev, but our contract requires us to not
-    # return any heads in that case, so discard that
-    result.discard(nullrev)
+    # The presence of nullrev will confuse heads(). So filter it out.
+    result = set(local.revs('heads(%ld)', common.bases - {nullrev}))
     elapsed = util.timer() - start
     progress.complete()
     ui.debug("%d total queries in %.4fs\n" % (roundtrips, elapsed))