[PATCH] sparse-revlog: protect C code against delta chain including nullrev

Boris FELD boris.feld at octobus.net
Fri Dec 14 16:05:01 EST 2018


On 03/12/2018 11:10, Yuya Nishihara wrote:
> On Sun, 2 Dec 2018 16:42:18 +0100, Boris FELD wrote:
>> On 30/11/2018 12:45, Yuya Nishihara wrote:
>>> On Thu, 29 Nov 2018 18:55:01 +0100, Boris Feld wrote:
>>>> # HG changeset patch
>>>> # User Boris Feld <boris.feld at octobus.net>
>>>> # Date 1543508919 -3600
>>>> #      Thu Nov 29 17:28:39 2018 +0100
>>>> # Node ID 5a6a715f4ed0fa4d47bdd6b6413797fe6cb17f88
>>>> # Parent  2f14d1bbc9a7a142b421285c0708320b46be7a56
>>>> # EXP-Topic sparse-followup
>>>> # Available At https://bitbucket.org/octobus/mercurial-devel/
>>>> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 5a6a715f4ed0
>>>> sparse-revlog: protect C code against delta chain including nullrev
>>>>
>>>> For unclear reasons, some repositories include nullrev (-1). Re-computing
>>>> delta for such repo remove nullrev from all chain, so some older versions have
>>>> been creating them.
>>>>
>>>> This currently raise an IndexError with the new C code doing chain slicing as
>>>> it expect all item to be positive.
>>>>
>>>> Both python and C code for reading delta chain preserve nullrev, and the
>>>> Python code for chain slicing does not raise an exception in this case. So we
>>>> take the safe route and make the new C code works fine in that case.
>>> Can't we instead get around the nullrev in Python code?
>>> I'm not a fan of including a hack in C for unclear reasons.
>> My preferred way to do this would be to filter out the -1 in deltachain.
>> (both C and Python).
> I don't know details, but yeah, it sounds like the best workaround if we
> can just pre-filter null revision.

So looking deeper into that, we cannot just filter null revision, the
delta chain expect to be able to apply delta on a null base :-/

Instead we are looking into fixing internal's (index_get_start & co) to
provide a return consistent with `index_get` (0 start, 0 lenght). V2, coming

> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list