sync, assistant: Sync with remotes that have annex-ignore set

This is so git remotes on servers without git-annex installed can be used
to keep clients' git repos in sync.

This is a behavior change, but since annex-sync can be set to disable
syncing with a remote, I think it's acceptable.
This commit is contained in:
Joey Hess 2013-04-22 14:57:09 -04:00
parent b9341fd4c0
commit 8861e270be
10 changed files with 22 additions and 17 deletions

View file

@ -48,18 +48,19 @@ modifyDaemonStatus a = do
calcSyncRemotes :: Annex (DaemonStatus -> DaemonStatus)
calcSyncRemotes = do
rs <- filter (remoteAnnexSync . Remote.gitconfig) .
concat . Remote.byCost <$> Remote.enabledRemoteList
concat . Remote.byCost <$> Remote.remoteList
alive <- trustExclude DeadTrusted (map Remote.uuid rs)
let good r = Remote.uuid r `elem` alive
let syncable = filter good rs
let nonxmpp = filter (not . isXMPPRemote) syncable
let syncdata = filter (not . remoteAnnexIgnore . Remote.gitconfig) $
filter (not . isXMPPRemote) syncable
return $ \dstatus -> dstatus
{ syncRemotes = syncable
, syncGitRemotes =
filter (not . Remote.specialRemote) syncable
, syncDataRemotes = nonxmpp
, syncingToCloudRemote = any iscloud nonxmpp
, syncDataRemotes = syncdata
, syncingToCloudRemote = any iscloud syncdata
}
where
iscloud r = not (Remote.readonly r) && Remote.globallyAvailable r

View file

@ -68,7 +68,9 @@ reconnectRemotes notifypushes rs = void $ do
go = do
(failed, diverged) <- sync
=<< liftAnnex (inRepo Git.Branch.current)
addScanRemotes diverged nonxmppremotes
addScanRemotes diverged $
filter (not . remoteAnnexIgnore . Remote.gitconfig)
nonxmppremotes
return failed
{- Updates the local sync branch, then pushes it to all remotes, in

View file

@ -157,7 +157,7 @@ handleMount :: FilePath -> Assistant ()
handleMount dir = do
debug ["detected mount of", dir]
rs <- filter (Git.repoIsLocal . Remote.repo) <$> remotesUnder dir
reconnectRemotes True $ filter (not . remoteAnnexIgnore . Remote.gitconfig) rs
reconnectRemotes True rs
{- Finds remotes located underneath the mount point.
-

View file

@ -128,4 +128,4 @@ handleConnection = reconnectRemotes True =<< networkRemotes
{- Finds network remotes. -}
networkRemotes :: Assistant [Remote]
networkRemotes = liftAnnex $
filter (isNothing . Remote.localpath) <$> enabledRemoteList
filter (isNothing . Remote.localpath) <$> remoteList

View file

@ -133,7 +133,7 @@ repoList reposelector
unwanted <- S.fromList
<$> filterM inUnwantedGroup (S.toList syncing)
rs <- filter selectedrepo . concat . Remote.byCost
<$> Remote.enabledRemoteList
<$> Remote.remoteList
let us = map Remote.uuid rs
let maker u
| u `S.member` unwanted = mkUnwantedRepoActions u