[darcs-users] question about pull code

Ganesh Sittampalam ganesh at earth.li
Tue Sep 8 20:49:10 UTC 2009


In Darcs.Commands.Pull is the following code:

       Sealed pw <- tentativelyMergePatches repository "pull" merge_opts
                    (reverseRL $ head $ unsafeUnRL us') to_be_pulled

us' is a RL (RL patches) containing the patches in our repo not also 
present in the repo we are pulling from. I'm trying to understand why we 
take the head of us' rather than doing a concat on it - do you (or anyone 
else) have any idea about this? It seems to have been that way for a very 
long time (in one guise or another).

This came up when I was trying to add type witnesses to 
Darcs.Commands.Pull - once I convert that code to the equivalent that uses 
witnesses, it builds fine if I do a concat, but not if I leave the head 
there, because the contexts simply don't match up.

I've tried asserting if the outer RL is anything other than length 1, and 
the test suite still passes, but that doesn't have any big repos so I 
don't know if the situation can come up in more complicated situations. 
I'm concerned that dropping the rest of the list is an important 
performance optimisation that's safe for some reason I don't understand.



More information about the darcs-users mailing list