D4319: setdiscovery: pass head revisions into sample functions

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


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

REVISION SUMMARY
  This eliminates the last remaining consumer of heads() and
  related functionality in dagutil.

REPOSITORY
  rHG Mercurial

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

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
@@ -92,24 +92,25 @@
                 dist.setdefault(p, d + 1)
                 visit.append(p)
 
-def _takequicksample(repo, dag, revs, size):
+def _takequicksample(repo, dag, headrevs, 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
+    :headrevs: set of head revisions in local DAG to consider
     :revs: set of revs to discover
     :size: the maximum size of the sample"""
     sample = set(repo.revs('heads(%ld)', revs))
 
     if len(sample) >= size:
         return _limitsample(sample, size)
 
-    _updatesample(dag, None, dag.heads(), sample, quicksamplesize=size)
+    _updatesample(dag, None, headrevs, sample, quicksamplesize=size)
     return sample
 
-def _takefullsample(repo, dag, revs, size):
+def _takefullsample(repo, dag, headrevs, revs, size):
     sample = set(repo.revs('heads(%ld)', revs))
 
     # update from heads
@@ -243,7 +244,7 @@
         if len(undecided) < targetsize:
             sample = list(undecided)
         else:
-            sample = samplefunc(local, dag, undecided, targetsize)
+            sample = samplefunc(local, dag, ownheads, undecided, targetsize)
 
         roundtrips += 1
         progress.update(roundtrips)



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


More information about the Mercurial-devel mailing list