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

Laurent Charignon lcharignon at fb.com
Thu May 21 17:57:08 CDT 2015



On 5/21/15, 2:15 PM, "Matt Mackall" <mpm at selenic.com> wrote:

>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?

We were just checking the wrong index in the filter, this works by adding
the offset in the second loop.

You are right and it is much better to simplify this function to avoid the
two loops, I will send a V3.


>
>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