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

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Sat Aug 18 04:07:06 EDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG140992750187: setdiscovery: use a revset for finding DAG heads in a subset (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4317?vs=10411&id=10438

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