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