summaryrefslogtreecommitdiff
path: root/Assistant/Threads/Pusher.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-06-25 20:16:30 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-06-25 20:16:30 -0400
commit05c4dfb9411e54c21aa4c0d49e3662117ac2f549 (patch)
tree91d37a10387066185250c99c93fba85d753f5e72 /Assistant/Threads/Pusher.hs
parent14015036bce2d6a4cf57775ccfc5310f0ec96082 (diff)
fixup merges now done when needed
Diffstat (limited to 'Assistant/Threads/Pusher.hs')
-rw-r--r--Assistant/Threads/Pusher.hs17
1 files changed, 13 insertions, 4 deletions
diff --git a/Assistant/Threads/Pusher.hs b/Assistant/Threads/Pusher.hs
index 6a4ae7838..82c37de5f 100644
--- a/Assistant/Threads/Pusher.hs
+++ b/Assistant/Threads/Pusher.hs
@@ -11,6 +11,7 @@ import Common.Annex
import Assistant.Commits
import Assistant.Pushes
import Assistant.ThreadedMonad
+import Assistant.Threads.Merger
import qualified Command.Sync
import Utility.ThreadScheduler
import Utility.Parallel
@@ -68,11 +69,19 @@ pushToRemotes :: UTCTime -> ThreadState -> FailedPushChan -> [Remote] -> IO ()
pushToRemotes now st pushchan remotes = do
(g, branch) <- runThreadState st $
(,) <$> fromRepo id <*> Command.Sync.currentBranch
- Command.Sync.updateBranch (Command.Sync.syncBranch branch) g
- failed <- map (`FailedPush` now) <$> inParallel (push g branch) remotes
- unless (null failed) $
- refillFailedPushes pushchan failed
+ go True branch g remotes
where
+ go shouldretry branch g rs = do
+ Command.Sync.updateBranch (Command.Sync.syncBranch branch) g
+ failed <- inParallel (push g branch) rs
+ unless (null failed) $
+ if shouldretry
+ then retry branch g rs
+ else refillFailedPushes pushchan $
+ map (`FailedPush` now) failed
push g branch remote =
ifM (Command.Sync.pushBranch remote branch g)
( exitSuccess, exitFailure)
+ retry branch g rs = do
+ runThreadState st $ manualPull branch rs
+ go False branch g rs