diff options
author | Joey Hess <joey@kitenet.net> | 2011-06-23 15:30:04 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-06-23 15:30:04 -0400 |
commit | c5531046bc6cd62cedfc528b844e0df9cdade177 (patch) | |
tree | 1a55cdedbc4b8debd10e7619a3ebfea9ea537d8a /Remote.hs | |
parent | 068703c40565cf8312c103b40d8c992b9d20a113 (diff) |
refactor
Diffstat (limited to 'Remote.hs')
-rw-r--r-- | Remote.hs | 21 |
1 files changed, 6 insertions, 15 deletions
@@ -131,19 +131,7 @@ remotesWithoutUUID rs us = filter (\r -> uuid r `notElem` us) rs {- Cost ordered lists of remotes that the LocationLog indicate may have a key. -} keyPossibilities :: Key -> Annex [Remote Annex] -keyPossibilities key = do - g <- Annex.gitRepo - u <- getUUID g - - -- get uuids of all remotes that are recorded to have the key - uuids <- keyLocations key - let validuuids = filter (/= u) uuids - - -- remotes that match uuids that have the key - allremotes <- genList - let validremotes = remotesWithUUID allremotes validuuids - - return $ sort validremotes +keyPossibilities key = return . fst =<< keyPossibilities' False key {- Cost ordered lists of remotes that the LocationLog indicate may have a key. - @@ -151,10 +139,13 @@ keyPossibilities key = do - (some may not have configured remotes). -} keyPossibilitiesTrusted :: Key -> Annex ([Remote Annex], [UUID]) -keyPossibilitiesTrusted key = do +keyPossibilitiesTrusted = keyPossibilities' True + +keyPossibilities' :: Bool -> Key -> Annex ([Remote Annex], [UUID]) +keyPossibilities' withtrusted key = do g <- Annex.gitRepo u <- getUUID g - trusted <- trustGet Trusted + trusted <- if withtrusted then trustGet Trusted else return [] -- get uuids of all remotes that are recorded to have the key uuids <- keyLocations key |