darcs-reviewed mirror — http://darcs.net
Fix how 'Prim' patches generator creates patches
Patches were creaated without using 'PrimContruct' constructors and that was producing file names that were not properly normalized. This problem caused tests to fail on Windows.
import Darcs.Patch.Prim
= do hunk <- aHunk content
return $ FP (ap2fn path) hunk
= do Hunk pos old new <- aHunk content
return $ hunk (ap2fp path) pos old new
= do tokrep <- aTokReplace content
return $ FP (ap2fn path) tokrep
= do TokReplace tokchars old new <- aTokReplace content
return $ tokreplace (ap2fp path) tokchars old new
return $ FP (ap2fn newPath) AddFile
return $ addfile (ap2fp newPath)
aRmFileP path = FP (ap2fn path) RmFile
aRmFileP path = rmfile (ap2fp path)
return $ DP (ap2fn newPath) AddDir
return $ adddir (ap2fp newPath)
aRmDirP path = DP (ap2fn path) RmDir
aRmDirP path = rmdir (ap2fp path)
return $ Move (ap2fn oldPath) (ap2fn newPath)
return $ move (ap2fp oldPath) (ap2fp newPath)
= do h1 <- aHunk content
= do h1@(Hunk l1 old1 new1) <- aHunk content
let h2 = Hunk (l2'+delta) old2 new2
return (FP fnPath h1 :> FP fnPath h2)
let l2 = l2'+delta
return (hunk fpPath l1 old1 new1 :> hunk fpPath l2 old2 new2)
fnPath = ap2fn path
fpPath = ap2fp path
, ap2fn
, ap2fp
import Darcs.Patch.FileName ( FileName, fp2fn )
ap2fn :: AnchoredPath -> FileName
ap2fn = fp2fn . anchorPath "."
ap2fp :: AnchoredPath -> FilePath
ap2fp = anchorPath ""