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

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

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.

Differential Revision: https://phab.mercurial-scm.org/D4317
parent 2d218db7
No related branches found
No related tags found
No related merge requests found
......@@ -96,7 +96,7 @@
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
......@@ -105,9 +105,10 @@
: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
......@@ -109,10 +110,11 @@
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)
......
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