diff options
Diffstat (limited to 'Assistant/Threads/MountWatcher.hs')
-rw-r--r-- | Assistant/Threads/MountWatcher.hs | 26 |
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. - |