Skip to content
Snippets Groups Projects
Commit abce899c authored by Gregory Szorc's avatar Gregory Szorc
Browse files

setdiscovery: pass head revisions into sample functions

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

Differential Revision: https://phab.mercurial-scm.org/D4319
parent 754f389b
No related branches found
No related tags found
No related merge requests found
......@@ -92,10 +92,10 @@
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
......@@ -96,9 +96,10 @@
"""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))
......@@ -106,6 +107,6 @@
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
......@@ -110,6 +111,6 @@
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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment