[darcs-devel] [patch1880] decouple RepoPatchV3 impl from NamedPrim

Ben Franksen ben.franksen at online.de
Sat Aug 31 22:28:21 UTC 2019


Am 31.08.19 um 21:42 schrieb Ganesh Sittampalam:
> On 31/08/2019 20:13, Ben Franksen wrote:
>>> http://bugs.darcs.net/file7890/refactor-the-commute-implementation-for-
>>> namedprims.dpatch
>>> http://bugs.darcs.net/file7906/make-d_p_v3_core-independent-of-
>>> namedprim_primpatchid.dpatch
>>>
>>> I think we sort of agreed on changes to the second one to not
>>> try to maintain the abstractness of RepoPatchV3 in the RepoPatchV3.Core
>>> module, but I haven't done them yet. (and it could probably be a followup
>>> that just removes both mkPrim and the pattern synonyms, rather than an
>>> amendment)
>>
>> Trying to apply any of these bundles to reviewed makes one of my cores
>> work at 100% without any visible progress. It has been running like that
>> now for a few minutes. I would have though that if patches are missing
>> from the context, I should get an error? Is this a regression? Running
>> it with --debug and redirecting to a file shows that it reads all the
>> patches in the repo. This doesn't take that long, however.
> 
> I was having similar trouble applying a different bundle earlier and
> just gave up and pulled from screened instead without investigating
> further. And I was using an old darcs, not head.

I think I know what is going on. Darcs.Patch.Bundle.parseBundle returns
a fake PatchSet where everything behind the latest tag given in the
context is set to NilRL. I knew this would bite us one day. It does now
because the context mentions a tag that is not in the repo where the
patches are to be applied. When we call findCommonAndUncommon with that
PatchSet and the tag is not found, we unwrap all Taggeds in both
PatchSets. This is completely wrong, of course. Why it seems to hang and
not immediately fail is something I do not understand yet, but if I
replace the definition of findCommonAndUncommon with this one:

findCommonAndUncommon us them
  | Fork common us' them' <- taggedIntersection us them
  , Fork common' us'' them'' <- findCommonFL (reverseRL us') (reverseRL
them') =
    Fork (PatchSet common (reverseFL common')) us'' them''

then it does fail immediately with

This is a bug! Please report it at http://bugs.darcs.net or via email to
darcs-users at darcs.net:
failed to commute common patches (lhs)
CallStack (from HasCallStack):
  error, called at src/Darcs/Patch/Ident.hs:238:16 in
darcs-2.15.1-inplace:Darcs.Patch.Ident

The fix is obvious: we should not return an invalid PatchSet when we
parse a bundle! Instead we should return the new patches and the context
as a pair. If the context ends with a tag, then we should first check
that we have that tag and fail if we don't. Otherwise we make that tag
clean (in our PatchSet, using splitOnTag) and can then directly call
findCommonFL with the rest of our patches and the rest of their context
plus new patches.



More information about the darcs-devel mailing list