[darcs-devel] FullUnwind rebase behaviour

Ben Franksen ben.franksen at online.de
Sun May 17 12:05:12 UTC 2020


Am 17.05.20 um 13:41 schrieb Ganesh Sittampalam:
> [...]

(I'll discuss your three-way-conflict scenario in another message.)

>> Let's take a simple conflict between two prims a and b. FullUnwind of
>> the conflicted b is roughly (before,patch,after) = (a^,b,b^).
>> ForceCommute of a^;b results in b'=a^ and trailing fixup a'^=b, which
>> indeed cancels with the b^. So that seems to work out.
>>
>> But now suppose we have (a) conflicting with (b;c), where c depends on
>> b, and d as resolution after that. Unwinding the conflicted b gives
>> (a^,b,b^) as before and then the conflicted c is [,{a},b:c] (it has no
>> effect, conflicts with a,  and has b in its context) and unwinding that
>> gives (b,c,c^b^). The trailing fixup from unwind b is b^ and that
>> annihilates with b. Assuming that c^b^ does not commute with d, our
>> rebase state becomes (a^,b)(,c)(c^b^,d).
>>
>> When we unsuspend, the trailing fixup from forceCommuting a^;b, namely b
>> has no b^ to cancel against so it gets stuck as (b,c). When in turn we
>> forceCommute (b;c), we push c into (c^b^,d), which gives us (b^;d). And
>> now  this is the conflict that gets reported on unsuspend.
> 
> Yes, I think this is roughly what happens in that test case.
> 
> I'm back to thinking we just inevitably lose information when we suspend
> a conflict by unwinding it, so we either need to do something cleverer
> (e.g. actually store suspended conflicts after all), or lower our
> expectations about what should work.

Perhaps not.

Looking closer at what happens here, we see that our current fullUnwind
is a bit too simple: it confuses dependencies with conflicts! In the
example, the trailing fixup from unwinding the conflicted b gets stuck
as a fixup for c. that means when unsuspending we treat it as if c were
in conflict with b^. This is clearly wrong.

So, when we fullUnwind we must distinguish between prims from the
context and prims from the effect of a conflictor. On unsuspend, we must
not try to forceCommute them, but instead should inject them.

Cheers
Ben



More information about the darcs-devel mailing list