refactor
This commit is contained in:
parent
068703c405
commit
c5531046bc
1 changed files with 6 additions and 15 deletions
21
Remote.hs
21
Remote.hs
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue