Skip to content

Commit

Permalink
Fix 'hackport diff additions' and 'hackport diff common'
Browse files Browse the repository at this point in the history
  • Loading branch information
kolmodin committed Feb 8, 2009
1 parent 8925e89 commit 3b9e456
Showing 1 changed file with 11 additions and 31 deletions.
42 changes: 11 additions & 31 deletions Diff.hs
Expand Up @@ -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
Expand Down Expand Up @@ -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.