diff options
author | Joey Hess <joey@kitenet.net> | 2014-02-01 10:33:55 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-02-01 10:33:55 -0400 |
commit | 6f622c6043ad8db9f27a16020c371af68506e8e7 (patch) | |
tree | ff3ac9ebc96979f98220dc15ca7356c3a0906022 /Assistant | |
parent | cf46308597d8633cc7bad9687f7f0baf91e14992 (diff) |
improve sync with xmpp and annex-ignore
* sync --content: Honor annex-ignore configuration.
* sync: Don't try to sync with xmpp remotes, which are only currently
supported when using the assistant.
Diffstat (limited to 'Assistant')
-rw-r--r-- | Assistant/DaemonStatus.hs | 8 | ||||
-rw-r--r-- | Assistant/Sync.hs | 8 | ||||
-rw-r--r-- | Assistant/Threads/XMPPClient.hs | 2 |
3 files changed, 6 insertions, 12 deletions
diff --git a/Assistant/DaemonStatus.hs b/Assistant/DaemonStatus.hs index e38463ff6..eb842b784 100644 --- a/Assistant/DaemonStatus.hs +++ b/Assistant/DaemonStatus.hs @@ -55,7 +55,7 @@ calcSyncRemotes = do let good r = Remote.uuid r `elem` alive let syncable = filter good rs let syncdata = filter (not . remoteAnnexIgnore . Remote.gitconfig) $ - filter (not . isXMPPRemote) syncable + filter (not . Remote.isXMPPRemote) syncable return $ \dstatus -> dstatus { syncRemotes = syncable @@ -257,11 +257,5 @@ alertDuring alert a = do i <- addAlert $ alert { alertClass = Activity } removeAlert i `after` a -{- Remotes using the XMPP transport have urls like xmpp::user@host -} -isXMPPRemote :: Remote -> Bool -isXMPPRemote remote = Git.repoIsUrl r && "xmpp::" `isPrefixOf` Git.repoLocation r - where - r = Remote.repo remote - getXMPPClientID :: Remote -> ClientID getXMPPClientID r = T.pack $ drop (length "xmpp::") (Git.repoLocation (Remote.repo r)) diff --git a/Assistant/Sync.hs b/Assistant/Sync.hs index adbe41350..fc95419ab 100644 --- a/Assistant/Sync.hs +++ b/Assistant/Sync.hs @@ -71,7 +71,7 @@ reconnectRemotes notifypushes rs = void $ do mapM_ signal $ filter (`notElem` failedrs) rs' where gitremotes = filter (notspecialremote . Remote.repo) rs - (xmppremotes, nonxmppremotes) = partition isXMPPRemote rs + (xmppremotes, nonxmppremotes) = partition Remote.isXMPPRemote rs notspecialremote r | Git.repoIsUrl r = True | Git.repoIsLocal r = True @@ -133,7 +133,7 @@ pushToRemotes' now notifypushes remotes = do <$> gitRepo <*> inRepo Git.Branch.current <*> getUUID - let (xmppremotes, normalremotes) = partition isXMPPRemote remotes + let (xmppremotes, normalremotes) = partition Remote.isXMPPRemote remotes ret <- go True branch g u normalremotes unless (null xmppremotes) $ do shas <- liftAnnex $ map fst <$> @@ -206,7 +206,7 @@ syncAction rs a return failed where visibleremotes = filter (not . Remote.readonly) $ - filter (not . isXMPPRemote) rs + filter (not . Remote.isXMPPRemote) rs {- Manually pull from remotes and merge their branches. Returns any - remotes that it failed to pull from, and a Bool indicating @@ -220,7 +220,7 @@ syncAction rs a manualPull :: Maybe Git.Ref -> [Remote] -> Assistant ([Remote], Bool) manualPull currentbranch remotes = do g <- liftAnnex gitRepo - let (xmppremotes, normalremotes) = partition isXMPPRemote remotes + let (xmppremotes, normalremotes) = partition Remote.isXMPPRemote remotes failed <- liftIO $ forM normalremotes $ \r -> ifM (Git.Command.runBool [Param "fetch", Param $ Remote.name r] g) ( return Nothing diff --git a/Assistant/Threads/XMPPClient.hs b/Assistant/Threads/XMPPClient.hs index 8eb469939..ab4de9257 100644 --- a/Assistant/Threads/XMPPClient.hs +++ b/Assistant/Threads/XMPPClient.hs @@ -322,7 +322,7 @@ pairMsgReceived urlrenderer PairReq theiruuid selfjid theirjid | baseJID selfjid == baseJID theirjid = autoaccept | otherwise = do knownjids <- mapMaybe (parseJID . getXMPPClientID) - . filter isXMPPRemote . syncRemotes <$> getDaemonStatus + . filter Remote.isXMPPRemote . syncRemotes <$> getDaemonStatus um <- liftAnnex uuidMap if elem (baseJID theirjid) knownjids && M.member theiruuid um then autoaccept |