Ben Franksen <[email protected]> added the comment:

> If it's a workaround for a bug

It is. (I'll say a few more words on that at the end.)

> it feels like it has quite a big impact on core logic for merging patches.

I hope I can convince you that the impact of the change is not as big as you 
make it it out to be. Let's first consider the change to robustMerge and merge 
for FLs.

(1) It does not make any semantic change to patch types that use the default 
implementation of robustMerge. The latter never returns Nothing2 and therefore 
the implementation of merge for FLs should behave identical to the previous 
one. I am willing to add unit tests to make sure this is the case.

(2) For those patch types that do have a custom robustMerge (Named, 
PatchInfoAnd), it changes behavior *precisely* in situations where Darcs 
previously would have crashed due to an error call ("cannot merge identical 
patches").

Second, consider the changes to findCommon*. They potentially impact any patch 
type with an identity, which includes RepoPatchV3 and its internals i.e. named 
prims. But again, the changes are limited to cases which previously were 
handled with an immediate error call, namely "cannot commute common patches" 
and "common patches are not identical". (It should be easy to verify this by 
inspection and I urge you to double-check that.) Thus, for patch types which do 
exhibit commutation consistency, the behavior is unchanged.

> Should it really be used for V3 for example?

I am not 100% happy about this either. If it were not for the stated 
difficulties in engineering it, I would prefer not to. An internal consistency 
check can detect problems even if the test suite for some reason fails to cover 
the particular scenario that triggers it. Given that we are likely to be the 
first to actually use darcs-3 seriously, this may help us to find such a bug 
before we cause damage to other people's repositories.

Anyway, I think we can get the same advantage if, instead of crashing with an 
error call, we merely print a loud warning message when we are about to run 
into any of the relevant cases. Would that be an acceptable compromise?

> Is there some way we could help people repair repositories instead?

I think repairing is possible as long as you know how to do better.

In contrast to the limitations that prevent us from detecting such problems 
early i.e. when we create Mergers / Conflictors / Duplicates, such a repair 
procedure could be given simultaneous access to all affected branches of the 
project. It would also be acceptable if it runs for a very long time, say, a 
few days.

Basically, we'd have to roll back everything up to to some known good state, 
and then re-create the history of records and merges / commutes "in a better 
way" i.e. consistently. For V3, we could hope to find and fix the underlying 
bug, so this might be realistic. But for V1/V2 the inconsistency problem is 
fundamental so I can't see how to "re-create a better history". The best we 
could offer is to convert the whole project to V3. (One more reason to finally 
get my act together and seriously start implementing that!)

> If it's a fundamental decision to change merge semantics

Repeat: It is not. What I wrote about in the other thread, while being inspired 
by this mitigation, is still highly speculative. For instance, I haven't 
(despite some efforts) been able to fix the proof for general permutivity yet. 
And even if we manage to solve all the technical problems in a satisfactory 
manner, I would still say this is an experimental feature for some future new 
patch format.

__________________________________
Darcs bug tracker <[email protected]>
<https://bugs.darcs.net/patch2455>
__________________________________
_______________________________________________
darcs-devel mailing list
[email protected]
https://lists.darcs.net/mailman/listinfo/darcs-devel

Reply via email to