avoid syncing remotes configured annex-ignore, unless explicitly specified

This commit is contained in:
Joey Hess 2011-12-31 01:42:42 -04:00
parent e7d3e546c2
commit 015a497914
2 changed files with 8 additions and 3 deletions

View file

@ -54,12 +54,12 @@ syncRemotes rs = do
else wanted
where
wanted
| null rs = filterM hasurl =<< Remote.remoteList
| null rs = filterM hasurl =<< Remote.enabledRemoteList
| otherwise = listed
listed = mapM Remote.byName rs
hasurl r = not . null <$> geturl r
geturl r = fromRepo $ Git.Config.get ("remote." ++ Remote.name r ++ ".url") ""
pickfast = (++) <$> listed <*> (fastest <$> Remote.remoteList)
pickfast = (++) <$> listed <*> (fastest <$> Remote.enabledRemoteList)
fastest = fromMaybe [] . headMaybe .
map snd . sort . M.toList . costmap
costmap = M.fromListWith (++) . map costpair

View file

@ -17,6 +17,7 @@ module Remote (
remoteTypes,
remoteList,
enabledRemoteList,
remoteMap,
byName,
prettyPrintUUIDs,
@ -85,6 +86,10 @@ remoteList = do
u <- getRepoUUID r
generate t r u (M.lookup u m)
{- All remotes that are not ignored. -}
enabledRemoteList :: Annex [Remote Annex]
enabledRemoteList = filterM (repoNotIgnored . repo) =<< remoteList
{- Map of UUIDs of Remotes and their names. -}
remoteMap :: Annex (M.Map UUID String)
remoteMap = M.fromList . map (\r -> (uuid r, name r)) <$> remoteList
@ -196,7 +201,7 @@ keyPossibilities' withtrusted key = do
let validtrusteduuids = validuuids `intersect` trusted
-- remotes that match uuids that have the key
allremotes <- filterM (repoNotIgnored . repo) =<< remoteList
allremotes <- enabledRemoteList
let validremotes = remotesWithUUID allremotes validuuids
return (sort validremotes, validtrusteduuids)