Mercurial > hg-stable
changeset 39202:140992750187
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
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 17 Aug 2018 17:26:07 +0000 |
parents | 2d218db7389b |
children | 754f389b87f2 |
files | mercurial/setdiscovery.py |
diffstat | 1 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/setdiscovery.py Fri Aug 17 17:21:11 2018 +0000 +++ b/mercurial/setdiscovery.py Fri Aug 17 17:26:07 2018 +0000 @@ -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,14 +105,16 @@ :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)