2012-06-22 17:39:44 +00:00
|
|
|
{- git-annex assistant commit tracking
|
|
|
|
-
|
|
|
|
- Copyright 2012 Joey Hess <joey@kitenet.net>
|
2012-06-23 05:20:40 +00:00
|
|
|
-
|
|
|
|
- Licensed under the GNU GPL version 3 or higher.
|
2012-06-22 17:39:44 +00:00
|
|
|
-}
|
|
|
|
|
|
|
|
module Assistant.Commits where
|
|
|
|
|
2012-10-29 23:35:18 +00:00
|
|
|
import Assistant.Common
|
|
|
|
import Assistant.Types.Commits
|
|
|
|
import Utility.TSet
|
2012-06-22 17:39:44 +00:00
|
|
|
|
2013-03-11 01:36:13 +00:00
|
|
|
import Control.Concurrent.STM
|
|
|
|
|
2012-06-22 17:39:44 +00:00
|
|
|
{- Gets all unhandled commits.
|
|
|
|
- Blocks until at least one commit is made. -}
|
2012-10-29 23:35:18 +00:00
|
|
|
getCommits :: Assistant [Commit]
|
2013-03-11 01:36:13 +00:00
|
|
|
getCommits = (atomically . getTSet) <<~ commitChan
|
2012-06-22 17:39:44 +00:00
|
|
|
|
|
|
|
{- Puts unhandled commits back into the channel.
|
|
|
|
- Note: Original order is not preserved. -}
|
2012-10-29 23:35:18 +00:00
|
|
|
refillCommits :: [Commit] -> Assistant ()
|
2013-03-11 01:36:13 +00:00
|
|
|
refillCommits cs = (atomically . flip putTSet cs) <<~ commitChan
|
2012-06-22 17:39:44 +00:00
|
|
|
|
|
|
|
{- Records a commit in the channel. -}
|
2012-10-29 23:35:18 +00:00
|
|
|
recordCommit :: Assistant ()
|
2013-03-11 01:36:13 +00:00
|
|
|
recordCommit = (atomically . flip putTSet1 Commit) <<~ commitChan
|