diff options
author | Joey Hess <joey@kitenet.net> | 2011-06-01 17:49:37 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-06-01 17:57:31 -0400 |
commit | a8fb97d2ce8e75b36b8e1572a83efd341e67d43e (patch) | |
tree | ab24a8af581281ff8b006309acfb4000317ad072 /Remote.hs | |
parent | 7a3d9d8c2e2bd53d0d4290e99186c6e37f18456d (diff) |
Add --trust, --untrust, and --semitrust options.
Diffstat (limited to 'Remote.hs')
-rw-r--r-- | Remote.hs | 28 |
1 files changed, 1 insertions, 27 deletions
@@ -16,9 +16,9 @@ module Remote ( hasKeyCheap, remoteTypes, + genList, byName, nameToUUID, - keyPossibilities, remotesWithUUID, remotesWithoutUUID, @@ -42,8 +42,6 @@ import RemoteClass import Types import UUID import qualified Annex -import Trust -import LocationLog import Locations import Utility import Config @@ -104,30 +102,6 @@ nameToUUID :: String -> Annex UUID nameToUUID "." = getUUID =<< Annex.gitRepo -- special case for current repo nameToUUID n = liftM uuid (byName n) -{- Cost ordered lists of remotes that the LocationLog indicate may have a key. - - - - Also returns a list of UUIDs that are trusted to have the key - - (some may not have configured remotes). - -} -keyPossibilities :: Key -> Annex ([Remote Annex], [UUID]) -keyPossibilities key = do - g <- Annex.gitRepo - u <- getUUID g - trusted <- trustGet Trusted - - -- get uuids of all remotes that are recorded to have the key - uuids <- liftIO $ keyLocations g key - let validuuids = filter (/= u) uuids - - -- note that validuuids is assumed to not have dups - let validtrusteduuids = intersect validuuids trusted - - -- remotes that match uuids that have the key - allremotes <- genList - let validremotes = remotesWithUUID allremotes validuuids - - return (sort validremotes, validtrusteduuids) - {- Filters a list of remotes to ones that have the listed uuids. -} remotesWithUUID :: [Remote Annex] -> [UUID] -> [Remote Annex] remotesWithUUID rs us = filter (\r -> uuid r `elem` us) rs |