[PATCH] discovery: improve some dealing with nullrev

Yuya Nishihara yuya at tcha.org
Thu Jan 17 06:31:47 EST 2019


On Tue, 15 Jan 2019 20:38:59 +0100, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld at octobus.net>
> # Date 1547465758 -3600
> #      Mon Jan 14 12:35:58 2019 +0100
> # Node ID b2b1b1f3a579d1d2ff880a2783e87fce72beee4e
> # Parent  32ef47b3c91c2913ab13cabf9efcdde3ef137987
> # EXP-Topic discovery.revset
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r b2b1b1f3a579
> discovery: improve some dealing with nullrev
> 
> According to our testing, `heads()` is no longer confused by nullrev. So we
> can avoid a potentially expensive iteration + testing.
> 
> diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
> --- a/mercurial/setdiscovery.py
> +++ b/mercurial/setdiscovery.py
> @@ -230,8 +230,9 @@ class partialdiscovery(object):
>          # heads(common) == heads(common.bases) since common represents
>          # common.bases and all its ancestors
>          # The presence of nullrev will confuse heads(). So filter it out.
> -        return set(self._repo.revs('heads(%ld)',
> -                   self._common.bases - {nullrev}))
> +        heads = set(self._repo.revs('heads(%ld)', self._common.bases))
> +        heads.discard(nullrev)
> +        return heads

This should be superseded by 2a8782cc2e16, "discovery: using the new
basesheads()."


More information about the Mercurial-devel mailing list