Dmitry: how do you feel about reviewing this one?  I'm asking
specifically because I want to have more people looking into
the "deep" parts of darcs and starting to understand it.

Hi David,

On Wed, Nov 19, 2008 at 10:06:37 -0500, David Roundy wrote:
> Here's a fix for issue1043

Hooray!

> (which recently bit a friend)

Boo.  This also bit us a few times (although only in the working
directory, with the workaround being to revert some stuff before
pulling more patches).  Trent's also submitted a duplicate of
this variant of issue1043:
  http://bugs.darcs.net/issue1198

And speaking of deep bugs, I still need to locate a sufficiently large
round tuit to boil
  http://bugs.darcs.net/issue1211
down into a test case.

> Wed Nov 19 10:02:34 EST 2008  David Roundy <[EMAIL PROTECTED]>
>   * resolve issue1043: avoid use of sort_coalesceFL in Patch.Real.
>   The trouble was that sort_coalesceFL does the "coalescing" which isn't
>   governed by strict rules.  This might have been fixed by changing
>   sort_coalesceFL to also run canonize, but the cleaner solution is to
>   simply acknowledge that what I really wanted was just to join together
>   pairs of inverses, which is much easier than the problem
>   sort_coalesceFL is trying to solve.
> 

Content-Description: A darcs patch for your repository!
> 
> New patches:
> 
> [resolve issue1043: avoid use of sort_coalesceFL in Patch.Real.
> David Roundy <[EMAIL PROTECTED]>**20081119150234
>  Ignore-this: 79003144c8571ef746108e09192cb4ed
>  The trouble was that sort_coalesceFL does the "coalescing" which isn't
>  governed by strict rules.  This might have been fixed by changing
>  sort_coalesceFL to also run canonize, but the cleaner solution is to
>  simply acknowledge that what I really wanted was just to join together
>  pairs of inverses, which is much easier than the problem
>  sort_coalesceFL is trying to solve.
> ] 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
> 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
> 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
> 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'') ->
> 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))
> replace ./src/Darcs/Patch/Real.hs [A-Za-z_0-9] sort_coalesce_effects 
> join_effects
> 

-- 
Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow>
PGP Key ID: 08AC04F9

Attachment: signature.asc
Description: Digital signature

_______________________________________________
darcs-users mailing list
[email protected]
http://lists.osuosl.org/mailman/listinfo/darcs-users

Reply via email to