summaryrefslogtreecommitdiff
path: root/Assistant/Threads/MountWatcher.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-08-22 14:32:17 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-08-22 14:32:17 -0400
commit68659f49983ca30a3c1a1a3f5e7da003f96741dc (patch)
tree31e100dcd657840b9628b043681bdd4a7e48e1c1 /Assistant/Threads/MountWatcher.hs
parent5a68acb521bae0277b2c8a8ca023dc57a5ff4b33 (diff)
refactor
Diffstat (limited to 'Assistant/Threads/MountWatcher.hs')
-rw-r--r--Assistant/Threads/MountWatcher.hs26
1 files changed, 4 insertions, 22 deletions
diff --git a/Assistant/Threads/MountWatcher.hs b/Assistant/Threads/MountWatcher.hs
index 82de186cc..3de594093 100644
--- a/Assistant/Threads/MountWatcher.hs
+++ b/Assistant/Threads/MountWatcher.hs
@@ -14,21 +14,17 @@ import Assistant.Common
import Assistant.ThreadedMonad
import Assistant.DaemonStatus
import Assistant.ScanRemotes
-import Assistant.Threads.Pusher (pushToRemotes)
-import Assistant.Alert
+import Assistant.Sync
import qualified Annex
import qualified Git
import Utility.ThreadScheduler
import Utility.Mounts
import Remote.List
import qualified Types.Remote as Remote
-import Assistant.Threads.Merger
-import qualified Git.Branch
import Control.Concurrent
import qualified Control.Exception as E
import qualified Data.Set as S
-import Data.Time.Clock
#if WITH_DBUS
import Utility.DBus
@@ -146,23 +142,9 @@ handleMounts st dstatus scanremotes wasmounted nowmounted =
handleMount :: ThreadState -> DaemonStatusHandle -> ScanRemoteMap -> FilePath -> IO ()
handleMount st dstatus scanremotes dir = do
debug thisThread ["detected mount of", dir]
- rs <- remotesUnder st dstatus dir
- unless (null rs) $ do
- let nonspecial = filter (Git.repoIsLocal . Remote.repo) rs
- unless (null nonspecial) $ do
- void $ alertWhile dstatus (syncAlert nonspecial) $ do
- debug thisThread ["syncing with", show nonspecial]
- sync nonspecial =<< runThreadState st (inRepo Git.Branch.current)
- addScanRemotes scanremotes nonspecial
- where
- sync rs (Just branch) = do
- runThreadState st $ manualPull (Just branch) rs
- now <- getCurrentTime
- pushToRemotes thisThread now st Nothing rs
- {- No local branch exists yet, but we can try pulling. -}
- sync rs Nothing = do
- runThreadState st $ manualPull Nothing rs
- return True
+ syncRemotes thisThread st dstatus scanremotes
+ =<< filter (Git.repoIsLocal . Remote.repo)
+ <$> remotesUnder st dstatus dir
{- Finds remotes located underneath the mount point.
-