Merge branch 'master' of http://darcs.haskell.org/ghc
[ghc.git] / distrib / compare / Change.hs
1
2 module Change where
3
4 data FileChange = First Change
5 | Second Change
6 | Change Change
7
8 data Change = DuplicateFile FilePath
9 | ExtraFile FilePath
10 | ExtraWay String
11 | ExtraThing String
12 | ThingVersionChanged String String String
13 | PermissionsChanged FilePath FilePath String String
14 | FileSizeChanged FilePath FilePath Integer Integer
15
16 isSizeChange :: FileChange -> Bool
17 isSizeChange (Change (FileSizeChanged {})) = True
18 isSizeChange _ = False
19
20 pprFileChange :: FileChange -> String
21 pprFileChange (First p) = "First " ++ pprChange p
22 pprFileChange (Second p) = "Second " ++ pprChange p
23 pprFileChange (Change p) = "Change " ++ pprChange p
24
25 pprChange :: Change -> String
26 pprChange (DuplicateFile fp) = "Duplicate file: " ++ show fp
27 pprChange (ExtraFile fp) = "Extra file: " ++ show fp
28 pprChange (ExtraWay w) = "Extra way: " ++ show w
29 pprChange (ExtraThing t) = "Extra thing: " ++ show t
30 pprChange (ThingVersionChanged t v1 v2)
31 = "Version changed for " ++ show t ++ ":\n"
32 ++ " " ++ v1 ++ " -> " ++ v2
33 pprChange (PermissionsChanged fp1 fp2 p1 p2)
34 = "Permissions changed:\n"
35 ++ " " ++ show fp1
36 ++ " " ++ show fp2
37 ++ " " ++ p1 ++ " -> " ++ p2
38 pprChange (FileSizeChanged fp1 fp2 s1 s2)
39 = "Size changed:\n"
40 ++ " " ++ show fp1 ++ "\n"
41 ++ " " ++ show fp2 ++ "\n"
42 ++ " " ++ show s1 ++ " -> " ++ show s2
43