{-# OPTIONS_GHC -fno-warn-orphans #-}
module Darcs.Patch.Prim.V1.Details
    ()
    where

import Darcs.Prelude

import Darcs.Patch.Prim.Class ( PrimDetails(..) )
import Darcs.Patch.Prim.V1.Core
    ( Prim(..), FilePatchType(..), DirPatchType(..) )
import Darcs.Patch.SummaryData ( SummDetail(..), SummOp(..) )


instance PrimDetails Prim where
  summarizePrim :: Prim wX wY -> [SummDetail]
summarizePrim (FP AnchoredPath
f (Hunk Int
_ [ByteString]
o [ByteString]
n)) = [SummOp -> AnchoredPath -> Int -> Int -> Int -> SummDetail
SummFile SummOp
SummMod AnchoredPath
f ([ByteString] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [ByteString]
o) ([ByteString] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [ByteString]
n) Int
0]
  summarizePrim (FP AnchoredPath
f (Binary ByteString
_ ByteString
_)) = [SummOp -> AnchoredPath -> Int -> Int -> Int -> SummDetail
SummFile SummOp
SummMod AnchoredPath
f Int
0 Int
0 Int
0]
  summarizePrim (FP AnchoredPath
f FilePatchType wX wY
AddFile) = [SummOp -> AnchoredPath -> Int -> Int -> Int -> SummDetail
SummFile SummOp
SummAdd AnchoredPath
f Int
0 Int
0 Int
0]
  summarizePrim (FP AnchoredPath
f FilePatchType wX wY
RmFile) = [SummOp -> AnchoredPath -> Int -> Int -> Int -> SummDetail
SummFile SummOp
SummRm AnchoredPath
f Int
0 Int
0 Int
0]
  summarizePrim (FP AnchoredPath
f (TokReplace{})) = [SummOp -> AnchoredPath -> Int -> Int -> Int -> SummDetail
SummFile SummOp
SummMod AnchoredPath
f Int
0 Int
0 Int
1]
  summarizePrim (DP AnchoredPath
d DirPatchType wX wY
AddDir) = [AnchoredPath -> SummDetail
SummAddDir AnchoredPath
d]
  summarizePrim (DP AnchoredPath
d DirPatchType wX wY
RmDir) = [AnchoredPath -> SummDetail
SummRmDir AnchoredPath
d]
  summarizePrim (Move AnchoredPath
f1 AnchoredPath
f2) = [AnchoredPath -> AnchoredPath -> SummDetail
SummMv AnchoredPath
f1 AnchoredPath
f2]
  summarizePrim (ChangePref{}) = [SummDetail
SummNone]