Hi David, Eric. I do not understand what mergeAfterConflicting and other functions using sort_coalesce_effects really do (it would take me looong time to fully understand it, but I am making some progress here :)). And I do not see how exactly this fixes issue1043. But the patch does what David says. So I think it should go in (with one minor change, perhaps, see below).
More comments below. Regards, Dmitry resolve issue1043: avoid use of sort_coalesceFL in Patch.Real. -------------------------------------------------------------- David Roundy <[EMAIL PROTECTED]>**20081119150234 hunk ./src/Darcs/Patch/Real.hs 33 > import Data.List ( partition, nub ) > import Darcs.Patch.Prim ( Prim, FromPrim(..), ToFromPrim(..), Conflict(..), > Effect(..), > showPrim, FileNameFormat(NewFormat), > - sort_coalesceFL, IsConflictedPrim(..), > ConflictState(..) ) > + IsConflictedPrim(..), ConflictState(..) ) > import Darcs.Patch.Read ( readPrim ) > import Darcs.Patch.Patchy > import Darcs.Ordered sort_coalesceFL is not used anymore. hunk ./src/Darcs/Patch/Real.hs 126 > case merge (ps :\/: qs) of > qs' :/\: _ -> mcn (Sealed (c > +>+ ps +>+ qs'):zs) > > -sort_coalesce_effects :: FL RealPatch C(x y) -> FL Prim C(x y) > -sort_coalesce_effects = sort_coalesceFL . effect > +sort_coalesce_effects :: Effect p => p C(x y) -> FL Prim C(x y) > +sort_coalesce_effects = join_inverses . effect > + where join_inverses :: FL Prim C(x y) -> FL Prim C(x y) > + join_inverses NilFL = NilFL > + join_inverses (p:>:ps) = case removeFL (invert p) ps' of > + Just ps'' -> ps'' > + Nothing -> p :>: ps' > + where ps' = join_inverses ps > > assertConsistent :: RealPatch C(x y) -> RealPatch C(x y) > assertConsistent x = assertDoc (do e <- is_consistent x The main change. sort_coalesceFL (I do not know what it does) replaced by join_inverses. join_inverses removes all inverse pairs from list of primitive patches. And effect makes FL of primitive patches from given patch (or list of patches). Type signature is changed to work with anything that belongs to Effect class. This way we can pass RL of patches to it below. hunk ./src/Darcs/Patch/Real.hs 175 > a:>p':>b -> > do (b',xs') <- mac b xs > goneby > --traceDoc (greenText > "foo1" $$ > - -- showPatch > (sort_coalesceFL $ > - -- > effect $ p':<:a)) $ Just () > - NilFL <- return $ > sort_coalesceFL $ effect $ p':<:a > + -- showPatch > (sort_coalesce_effects $ p':<:a)) $ Just () > + NilFL <- return $ > sort_coalesce_effects $ p':<:a > return (reverseRL > (p':<:a)+>+b', xs') > `mplus` do NilFL <- > return goneby Use sort_coalesce_effects instead of sort_coalesceFL. It would be easier to read if "sort_coalesce_effects $ p':<:a" is bound to a name with let. Not sure if it worth changing though. hunk ./src/Darcs/Patch/Real.hs 179 > - NilFL <- > return $ sort_coalesceFL $ > - > effect (p:<:ps) > + NilFL <- > return $ sort_coalesce_effects (p:<:ps) > return > (reverseRL (p:<:ps), > > mapFL_FL Normal xs) > Right (l:>p'') -> same here hunk ./src/Darcs/Patch/Real.hs 190 > a:>p':>b -> > do (b',xs') <- mac b xs > goneby > --traceDoc (greenText > "foo2" $$ > - -- showPatch > (sort_coalesceFL $ > - -- > effect $ p':<:a)) $ Just () > - NilFL <- return $ > sort_coalesceFL $ effect $ p':<:a > + -- showPatch > (sort_coalesce_effects $ p':<:a)) $ Just () > + NilFL <- return $ > sort_coalesce_effects $ p':<:a > return $ (reverseRL > (p':<:a)+>+b', xs') > > geteff :: [Non RealPatch C(x)] -> FL Prim C(x y) -> ([Non RealPatch C(x)], > FL RealPatch C(x y)) same here. And "sort_coalesce_effects $ p':<:a" can be bound to avoid duplication here as well. replace ./src/Darcs/Patch/Real.hs [A-Za-z_0-9] sort_coalesce_effects join_effects Rename sort_coalesce_effects to join_effects. _______________________________________________ darcs-users mailing list [email protected] http://lists.osuosl.org/mailman/listinfo/darcs-users
