New submission from Ben Franksen <[email protected]>:

Note that I am using the term "conflict unravelling" here, as recently proposed 
on 
@darcs-devel, for what the 'resolveConflicts' procedure does.

Unravelling conflicts is quite involved and doesn't scale too well: it's at 
least 
quadratic in the number of patches to consider, which is at least as long as 
the 
trailing sequence of un-tagged patches. It would make sense to cache that 
information somehow.

This is not difficult in principle. The (unmangled) unravellings are a list of 
sets 
of sequences of prims, which can readily be sequentialized on disk. The 
problems 
are in the details.

For compatibility, we need to be able to tell whether this cache, if available 
at 
all, is up-to-date. This can be managed by including the hash of the inventory 
for 
which we calculated them. If it coincides with the current head inventory hash, 
we 
are fine, otherwise we need to re-calculate.

A more serious problem is that we typically add our unrecorded changes as a 
temporary "anonymous" Named patch before unravelling conflicts. It doesn't make 
much sense to cache it in this form, since unrecorded changes are volatile and 
also 
not considered when pulling from or cloning a remote repo.

This begs the question: given a repo consisting of patches (ps;p), where p is 
/not/ 
itself conflicted, and the result of unravel (ps), can we (cheaply) calculate 
unravel (ps;p) i.e. without looking at the sequence ps? My gut feeling tells me 
that this should be possible.

Here is a rough sketch: We handle each (transitive) conflict separately as 
follows: 
we wrap its alternatives as anonymous V3 patches. If p conflicts with all 
alternatives we regard the whole conflict as resolved and drop it, because that 
means none of the involved conflictors would have commuted past p. If it 
cleanly 
merges with all of them, we are also done. Otherwise, for each conflicted 
alternative q', unravel p;q'. (Notice that normally we would also have to pass 
the 
context ps, but here this is not necessary, indeed no references to anything in 
ps 
can be involved.) Prepend q' to the resulting new alternatives and add them to 
the 
set of existing alternatives. Finally, join all conflict sets for which any 
alternative had a conflict with p (into a single transitive conflict set).

If all of this works out, it might also point toward a solution for the long-
standing problem of the unrecoverable conflict markup after rebase unsuspend.

----------
messages: 24164
nosy: bfrk
priority: feature
status: unknown
title: can we cache conflict unravellings?

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

Reply via email to