the syncer now pushes out changes to remotes, in parallel

Note that, since this always pushes branch synced/master to the remote, it
assumes that master has already gotten all the commits that are on the
remote merged in. Otherwise, fast-forward prevention may prevent the push.

That's probably ok, because the next stage is to automatically detect
incoming pushes and merge.
This commit is contained in:
Joey Hess 2012-06-22 15:46:21 -04:00
parent 28e28bc043
commit e9630e90de
4 changed files with 105 additions and 28 deletions

20
Utility/Parallel.hs Normal file
View file

@ -0,0 +1,20 @@
{- parallel processes
-
- Copyright 2012 Joey Hess <joey@kitenet.net>
-
- Licensed under the GNU GPL version 3 or higher.
-}
module Utility.Parallel where
import Common
{- Runs an action in parallel with a set of values.
- Returns values that caused the action to fail. -}
inParallel :: (v -> IO ()) -> [v] -> IO [v]
inParallel a v = do
pids <- mapM (forkProcess . a) v
statuses <- mapM (getProcessStatus True False) pids
return $ map fst $ filter failed $ zip v statuses
where
failed (_, status) = status /= Just (Exited ExitSuccess)