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.
|
{- Cost ordered lists of remotes that the LocationLog indicate may have a key.
|
||||||
-}
|
-}
|
||||||
keyPossibilities :: Key -> Annex [Remote Annex]
|
keyPossibilities :: Key -> Annex [Remote Annex]
|
||||||
keyPossibilities key = do
|
keyPossibilities key = return . fst =<< keyPossibilities' False key
|
||||||
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
|
|
||||||
|
|
||||||
{- Cost ordered lists of remotes that the LocationLog indicate may have a 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).
|
- (some may not have configured remotes).
|
||||||
-}
|
-}
|
||||||
keyPossibilitiesTrusted :: Key -> Annex ([Remote Annex], [UUID])
|
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
|
g <- Annex.gitRepo
|
||||||
u <- getUUID g
|
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
|
-- get uuids of all remotes that are recorded to have the key
|
||||||
uuids <- keyLocations key
|
uuids <- keyLocations key
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue