[PATCH V2] discovery: be more conservative when adjusting the sample size

Yuya Nishihara yuya at tcha.org
Fri Jun 7 21:36:02 EDT 2019


On Thu, 06 Jun 2019 10:52:22 +0200, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at octobus.net>
> # Date 1559726605 -7200
> #      Wed Jun 05 11:23:25 2019 +0200
> # Node ID 84886efab235050be22d3fd737226c6473004f24
> # Parent  12793787439538411013edffe0f9b98762d38a37
> # EXP-Topic discovery-large-undecided
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 84886efab235
> discovery: be more conservative when adjusting the sample size

Queued with minor tweaks, thanks.

> diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
> --- a/mercurial/setdiscovery.py
> +++ b/mercurial/setdiscovery.py
> @@ -241,14 +241,18 @@ class partialdiscovery(object):
>          _updatesample(revs, revsheads, sample, parentrevs)
>  
>          # update from roots
> -        revsroots = set(repo.revs('roots(%ld)', revs))
> -        if not self._respectsize:
> -            size = max(size, len(revsroots))
>  
>          childrenrevs = self._childrengetter()
>  
> +        revsroots = set(repo.revs('roots(%ld)', revs))
>          _updatesample(revs, revsroots, sample, childrenrevs)
>          assert sample
> +
> +        if not self._respectsize:
> +            nbroots = len(revsroots)
> +            nbheads = len(revsheads)
> +            size = max(size, min(nbroots, nbheads))

Inlined these variables since len(xxx) seems more readable than nbxxx.


More information about the Mercurial-devel mailing list