hook up syncing toggles

Although I observe that these toggles don't always prevent syncing.
When a transfer scan is active, it will still queue items from the disabled
remote.

Also, transfers from a disabled remote show up as from "unknown", which is
not ideal.
This commit is contained in:
Joey Hess 2012-10-12 12:45:16 -04:00
parent 06831e7754
commit 3f06c883f2
4 changed files with 51 additions and 33 deletions

View file

@ -27,6 +27,7 @@ module Remote (
byCost,
prettyPrintUUIDs,
prettyListUUIDs,
repoFromUUID,
remotesWithUUID,
remotesWithoutUUID,
keyLocations,
@ -52,6 +53,7 @@ import Logs.UUID
import Logs.Trust
import Logs.Location
import Remote.List
import qualified Git
{- Map from UUIDs of Remotes to a calculated value. -}
remoteMap :: (Remote -> a) -> Annex (M.Map UUID a)
@ -145,6 +147,17 @@ prettyListUUIDs uuids = do
where
n = finddescription m u
{- Gets the git repo associated with a UUID.
- There's no associated remote when this is the UUID of the local repo. -}
repoFromUUID :: UUID -> Annex (Git.Repo, Maybe Remote)
repoFromUUID u = ifM ((==) u <$> getUUID)
( (,) <$> gitRepo <*> pure Nothing
, do
remote <- fromMaybe (error "Unknown UUID") . M.lookup u
<$> remoteMap id
return (repo remote, Just remote)
)
{- Filters a list of remotes to ones that have the listed uuids. -}
remotesWithUUID :: [Remote] -> [UUID] -> [Remote]
remotesWithUUID rs us = filter (\r -> uuid r `elem` us) rs