[PATCH V2] changelog: fix bug in native head computation

Matt Mackall mpm at selenic.com
Thu May 21 16:15:05 CDT 2015


On Thu, 2015-05-21 at 12:56 -0700, Laurent Charignon wrote:
> # HG changeset patch
> # User Laurent Charignon <lcharignon at fb.com>
> # Date 1432236833 25200
> #      Thu May 21 12:33:53 2015 -0700
> # Node ID 86a3b8c985bd1d7ab831ccf5f00ddfba266c9e58
> # Parent  451df92cec4912aefac57a4cf82e9268192c867b
> changelog: fix bug in native head computation
> 
> Native head computations was not taking filtering properly into account pending
> changes in the index. We also add a test to avoid introducing regression.
> 
> diff --git a/mercurial/parsers.c b/mercurial/parsers.c
> --- a/mercurial/parsers.c
> +++ b/mercurial/parsers.c
> @@ -1263,7 +1263,7 @@
>  			goto bail;
>  		}
>  
> -		isfiltered = check_filter(filter, i);
> +		isfiltered = check_filter(filter, i + self->raw_length);

This seems very mysterious to me?

The index object stores two pieces: the packed form from disk.. and a
list of elements we've added in memory. The number of elements from the
first part is self->raw_length. It's not clear why this has any relation
to filtering.

Instead, it seems:

- this function should iterate over the entire length (locally named
'len')
- index_deref only handles up to raw_length
- index_get hands back a Python tuple
- index_get_parents does what you want

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial-devel mailing list