summaryrefslogtreecommitdiff
path: root/Assistant/Types
diff options
context:
space:
mode:
Diffstat (limited to 'Assistant/Types')
-rw-r--r--Assistant/Types/Changes.hs19
1 files changed, 12 insertions, 7 deletions
diff --git a/Assistant/Types/Changes.hs b/Assistant/Types/Changes.hs
index 887aa819e..d4e1b28bc 100644
--- a/Assistant/Types/Changes.hs
+++ b/Assistant/Types/Changes.hs
@@ -8,20 +8,26 @@
module Assistant.Types.Changes where
import Types.KeySource
+import Types.Key
import Utility.TSet
import Data.Time.Clock
-data ChangeType = AddChange | LinkChange | RmChange | RmDirChange
+data ChangeInfo = AddChange Key | LinkChange (Maybe Key) | RmChange | RmDirChange
deriving (Show, Eq)
+changeInfoKey :: ChangeInfo -> Maybe Key
+changeInfoKey (AddChange k) = Just k
+changeInfoKey (LinkChange (Just k)) = Just k
+changeInfoKey _ = Nothing
+
type ChangeChan = TSet Change
data Change
= Change
{ changeTime :: UTCTime
, changeFile :: FilePath
- , changeType :: ChangeType
+ , changeInfo :: ChangeInfo
}
| PendingAddChange
{ changeTime ::UTCTime
@@ -44,11 +50,10 @@ isInProcessAddChange :: Change -> Bool
isInProcessAddChange (InProcessAddChange {}) = True
isInProcessAddChange _ = False
-finishedChange :: Change -> Change
-finishedChange c@(InProcessAddChange { keySource = ks }) = Change
+finishedChange :: Change -> Key -> Change
+finishedChange c@(InProcessAddChange { keySource = ks }) k = Change
{ changeTime = changeTime c
, changeFile = keyFilename ks
- , changeType = AddChange
+ , changeInfo = AddChange k
}
-finishedChange c = c
-
+finishedChange c _ = c