summaryrefslogtreecommitdiff
path: root/Assistant/Commits.hs
blob: 6c27ce3cb477d9f2a464a6058602ea6bac7a29a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{- git-annex assistant commit tracking
 -
 - Copyright 2012 Joey Hess <joey@kitenet.net>
 -
 - Licensed under the GNU GPL version 3 or higher.
 -}

module Assistant.Commits where

import Utility.TSet

type CommitChan = TSet Commit

data Commit = Commit

newCommitChan :: IO CommitChan
newCommitChan = newTSet

{- Gets all unhandled commits.
 - Blocks until at least one commit is made. -}
getCommits :: CommitChan -> IO [Commit]
getCommits = getTSet

{- Puts unhandled commits back into the channel.
 - Note: Original order is not preserved. -}
refillCommits :: CommitChan -> [Commit] -> IO ()
refillCommits = putTSet

{- Records a commit in the channel. -}
recordCommit :: CommitChan -> IO ()
recordCommit = flip putTSet1 Commit