split and lift Assistant.Pushes

This commit is contained in:
Joey Hess 2012-10-29 17:52:43 -04:00
parent d5a5c05a79
commit 87ba4f8677
8 changed files with 82 additions and 64 deletions

View file

@ -100,17 +100,15 @@ pushToRemotes now notifypushes remotes = do
if null failed
then do
when notifypushes $
notifyPush (map Remote.uuid succeeded) <<~ pushNotifier
notifyPush (map Remote.uuid succeeded)
return True
else if shouldretry
then retry branch g u failed
else fallback branch g u failed
updatemap succeeded failed = do
pushmap <- getAssistant failedPushMap
liftIO $ changeFailedPushMap pushmap $ \m ->
M.union (makemap failed) $
M.difference m (makemap succeeded)
updatemap succeeded failed = changeFailedPushMap $ \m ->
M.union (makemap failed) $
M.difference m (makemap succeeded)
makemap l = M.fromList $ zip l (repeat now)
retry branch g u rs = do
@ -124,7 +122,7 @@ pushToRemotes now notifypushes remotes = do
inParallel (pushfallback g u branch) rs
updatemap succeeded failed
when (notifypushes && (not $ null succeeded)) $
notifyPush (map Remote.uuid succeeded) <<~ pushNotifier
notifyPush (map Remote.uuid succeeded)
return $ null failed
push g branch remote = Command.Sync.pushBranch remote branch g