Skip to content
Browse files

Fix 'hackport diff additions' and 'hackport diff common'

  • Loading branch information...
1 parent 8925e89 commit 3b9e45692aa05504e676df86b8fa6d9560fc4b6a @kolmodin kolmodin committed
Showing with 11 additions and 31 deletions.
  1. +11 −31 Diff.hs
View
42 Diff.hs
@@ -125,9 +125,17 @@ diff hackage overlay dm = do
InBoth o h -> h>o
_ -> False
ShowMissing -> case st of
- OnlyInRight _ -> True
- InBoth x y -> x < y
- OnlyInLeft _ -> False
+ OnlyInLeft _ -> False
+ InBoth x y -> x < y
+ OnlyInRight _ -> True
+ ShowAdditions -> case st of
+ OnlyInLeft _ -> True
+ InBoth x y -> x > y
+ OnlyInRight _ -> False
+ ShowCommon -> case st of
+ OnlyInLeft _ -> False
+ InBoth x y -> x == y
+ OnlyInRight _ -> False
_ -> True
-- | We get the 'PackageCompareInfo' by combining the info for the overlay
@@ -177,31 +185,3 @@ groupOn :: Ord key => (a -> key) -> [a] -> [(key,[a])]
groupOn key = map (\xs -> (key (head xs), xs))
. groupBy (equating key)
. sortBy (comparing key)
-{-
-diff :: Portage -> Portage -> DiffMode -> IO ()
-diff pt1 pt2 mode = do
- let pkgs1 = Map.map (OnlyLeft . eVersion . maximum) pt1
- let pkgs2 = Map.map (OnlyRight . eVersion . maximum) pt2
- let union = Map.unionWith (\(OnlyLeft x) (OnlyRight y) -> Both x y) pkgs1 pkgs2
- let showFilter st = case mode of
- ShowAll -> True
- ShowMissing -> case st of
- OnlyLeft _ -> True
- Both x y -> x > y
- OnlyRight _ -> False
- ShowAdditions -> case st of
- OnlyLeft _ -> False
- Both x y -> x < y
- OnlyRight _ -> True
- ShowNewer -> case st of
- OnlyLeft _ -> False
- Both x y -> x > y
- OnlyRight _ -> False
- ShowCommon -> case st of
- OnlyLeft _ -> False
- Both x y -> x == y
- OnlyRight _ -> False
- ShowPackages _ -> True
- let packages = filter (showFilter . snd) (Map.assocs union)
- mapM_ (putStrLn . uncurry showDiffState) packages
--}

0 comments on commit 3b9e456

Please sign in to comment.
Something went wrong with that request. Please try again.