D4317: setdiscovery: use a revset for finding DAG heads in a subset

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Fri Aug 17 21:30:56 UTC 2018


indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The march towards moving away from dagutil continues.
  
  Like other patches moving us away from dagutil, there is the
  potential for regressions to occur because revlogdag's
  headsetofconnecteds() uses revlog.index, which doesn't take
  filtering into account. The revset layer does. But no tests
  fail, so we appear to be in the clear.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4317

AFFECTED FILES
  mercurial/setdiscovery.py

CHANGE DETAILS

diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py
+++ b/mercurial/setdiscovery.py
@@ -96,23 +96,25 @@
                 dist.setdefault(p, d + 1)
                 visit.append(p)
 
-def _takequicksample(dag, revs, size):
+def _takequicksample(repo, dag, revs, size):
     """takes a quick sample of size <size>
 
     It is meant for initial sampling and focuses on querying heads and close
     ancestors of heads.
 
     :dag: a dag object
     :revs: set of revs to discover
     :size: the maximum size of the sample"""
-    sample = dag.headsetofconnecteds(revs)
+    sample = set(repo.revs('heads(%ld)', revs))
+
     if len(sample) >= size:
         return _limitsample(sample, size)
     _updatesample(dag, None, sample, quicksamplesize=size)
     return sample
 
-def _takefullsample(dag, revs, size):
-    sample = dag.headsetofconnecteds(revs)
+def _takefullsample(repo, dag, revs, size):
+    sample = set(repo.revs('heads(%ld)', revs))
+
     # update from heads
     _updatesample(dag, revs, sample)
     # update from roots
@@ -242,7 +244,7 @@
         if len(undecided) < targetsize:
             sample = list(undecided)
         else:
-            sample = samplefunc(dag, undecided, targetsize)
+            sample = samplefunc(local, dag, undecided, targetsize)
 
         roundtrips += 1
         progress.update(roundtrips)



To: indygreg, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list