[PATCH] changelog: make native head computation aware of filtering

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed May 20 18:09:19 CDT 2015



On 05/20/2015 06:01 PM, Laurent Charignon wrote:
> # HG changeset patch
> # User Laurent Charignon <lcharignon at fb.com>
> # Date 1432162260 25200
> #      Wed May 20 15:51:00 2015 -0700
> # Node ID a89ff1dfbc175d72d6654ec6e94e52fe81c1875c
> # Parent  a39c35e8e559e238f311c647679e8de3b91748c6
> changelog: make native head computation aware of filtering
>
> The code to compute the heads natively was returning all of the heads of
> the repository regardless of filtering state. This patch makes the native
> implementation of headrevs() discard the filtered heads matching the pure
> implementation.
>
> diff --git a/mercurial/changelog.py b/mercurial/changelog.py
> --- a/mercurial/changelog.py
> +++ b/mercurial/changelog.py
> @@ -175,7 +175,9 @@
>       def headrevs(self):
>           if self.filteredrevs:
>               try:
> -                return self.index.headrevsfiltered(self.filteredrevs)
> +                return [h for h
> +                          in self.index.headrevsfiltered(self.filteredrevs)
> +                          if h not in self.filteredrevs]

This "does not make senses to me"².

1) the reason for which we pass 'self.filteredrevs' to 
'headrevsfiltered' is for it to respect this filtering. If it return 
anything unfiltered it is clearly not doing its job.

2) You cannot just drop filtered head like that. consider the following 
case:

   x B
   |
   o A
   |

Unfiltered heads are [B].
visible heads are [A].

Just dropping filtered entry from unfiltered heads would give your 
"visible heads are []".


-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list