Jason Dagit <no-re...@example.com> added the comment:

I started reviewing this (I'm also happy to finish it off if Benedikt is busy).

I noticed this comment in the code:
-- | The latest Patch that touches the file is always the first in the list
type TouchingMap = Map FileId (Set PatchId)

I was skeptical that (Set PatchId) would keep things sorted correctly in all 
cases.  I looked at how 
Set would be storing things:
-- | The PatchId identifies a patch and can be created from a PatchInfo with 
make_filename
type PatchId = String

So the sort order comes down to string sorting.  The next question is, how are 
the PatchIds created?  
The comment in other places say to use make_filename, which is now renamed to 
makeFilename:
-- This makes darcs-1 (non-hashed repos) filenames, and is also generally used 
in both in
-- hashed and non-hashed repo code for making patch "hashes"
makeFilename :: PatchInfo -> String
makeFilename pi =
    showIsoDateTime d++"-"++sha1_a++"-"++sha1PS sha1_me++".gz"
        where b2ps True = BC.pack "t"
              b2ps False = BC.pack "f"
              sha1_me = B.concat [_piName pi,
                                  _piAuthor pi,
                                  _piDate pi,
                                  B.concat $ _piLog pi,
                                  b2ps $ isInverted pi]
              d = readPatchDate $ _piDate pi
              sha1_a = take 5 $ sha1PS $ _piAuthor pi

The interesting and relevant bit is that the patchids start with an ISO 
Date/Time.

Because patches can commuted and stored in a different order than the order 
they are created in, the 
type of TouchingMap means sometimes it may be possible for the patch index will 
store touching files 
in the wrong order.

I'll see if I can come up with an example that would be wrong with (Set 
PatchId) and correct with 
[PatchId].  Of course, the "trivial" example is when patches that touch the 
same file are created at 
nearly the same time on different machines.  In that scenario, one machine 
could have clock that is 
behind the other.  If it the clocks were enough different you could imagine the 
patches being in the 
wrong order in the index.

__________________________________
Darcs bug tracker <b...@darcs.net>
<http://bugs.darcs.net/patch173>
__________________________________
_______________________________________________
darcs-users mailing list
darcs-users@darcs.net
http://lists.osuosl.org/mailman/listinfo/darcs-users

Reply via email to