diff options
author | Joey Hess <joey@kitenet.net> | 2013-03-10 21:36:13 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-03-10 22:10:26 -0400 |
commit | 9d5b42222a10050fc733a49c427359f88e8be36c (patch) | |
tree | 4fa0b1d6cf4a38ba772557dc4277fbd887020e46 /Assistant/Changes.hs | |
parent | e107ddb4507d92303e14ebee3ccdec7662350031 (diff) |
assistant: generate better commits for renames
Diffstat (limited to 'Assistant/Changes.hs')
-rw-r--r-- | Assistant/Changes.hs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Assistant/Changes.hs b/Assistant/Changes.hs index 9114f5124..60372f316 100644 --- a/Assistant/Changes.hs +++ b/Assistant/Changes.hs @@ -12,6 +12,7 @@ import Assistant.Types.Changes import Utility.TSet import Data.Time.Clock +import Control.Concurrent.STM {- Handlers call this when they made a change that needs to get committed. -} madeChange :: FilePath -> ChangeInfo -> Assistant (Maybe Change) @@ -27,13 +28,17 @@ pendingAddChange f = Just <$> (PendingAddChange <$> liftIO getCurrentTime <*> pu {- Gets all unhandled changes. - Blocks until at least one change is made. -} getChanges :: Assistant [Change] -getChanges = getTSet <<~ changeChan +getChanges = (atomically . getTSet) <<~ changeChan + +{- Gets all unhandled changes, without blocking. -} +getAnyChanges :: Assistant [Change] +getAnyChanges = (atomically . readTSet) <<~ changeChan {- Puts unhandled changes back into the channel. - Note: Original order is not preserved. -} refillChanges :: [Change] -> Assistant () -refillChanges cs = flip putTSet cs <<~ changeChan +refillChanges cs = (atomically . flip putTSet cs) <<~ changeChan {- Records a change in the channel. -} recordChange :: Change -> Assistant () -recordChange c = flip putTSet1 c <<~ changeChan +recordChange c = (atomically . flip putTSet1 c) <<~ changeChan |