diff options
author | 2011-11-18 13:22:48 -0400 | |
---|---|---|
committer | 2011-11-18 13:22:48 -0400 | |
commit | c50a5fbeb4f90041f16cc84bf6b39577655d42b6 (patch) | |
tree | bf8e72086c6dc5ba947c76a6eb178ba38475bd7f /Logs/Trust.hs | |
parent | 1326bb863516b5e7efbfd9fba2754a3fe7289315 (diff) |
status: Include all special remotes in the list of repositories.
Special remotes do not always have a description listed in uuid.log,
and such ones were not listed before.
Diffstat (limited to 'Logs/Trust.hs')
-rw-r--r-- | Logs/Trust.hs | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/Logs/Trust.hs b/Logs/Trust.hs index 072ea41d6..e447fbebc 100644 --- a/Logs/Trust.hs +++ b/Logs/Trust.hs @@ -20,20 +20,30 @@ import Types.TrustLevel import qualified Annex.Branch import qualified Annex import Logs.UUIDBased -import Logs.UUID {- Filename of trust.log. -} trustLog :: FilePath trustLog = "trust.log" -{- Returns a list of UUIDs at the specified trust level. -} +{- Returns a list of UUIDs that the trustLog indicates have the + - specified trust level. + - Note that the list can be incomplete for SemiTrusted, since that's + - the default. -} trustGet :: TrustLevel -> Annex [UUID] -trustGet SemiTrusted = do -- special case; trustMap does not contain all these - others <- M.keys . M.filter (/= SemiTrusted) <$> trustMap - alluuids <- uuidList - return $ alluuids \\ others trustGet level = M.keys . M.filter (== level) <$> trustMap +{- Partitions a list of UUIDs to those matching a TrustLevel and not. -} +trustPartition :: TrustLevel -> [UUID] -> Annex ([UUID], [UUID]) +trustPartition level ls + | level == SemiTrusted = do + t <- trustGet Trusted + u <- trustGet UnTrusted + let uncandidates = t ++ u + return $ partition (`notElem` uncandidates) ls + | otherwise = do + candidates <- trustGet level + return $ partition (`elem` candidates) ls + {- Read the trustLog into a map, overriding with any - values from forcetrust. The map is cached for speed. -} trustMap :: Annex TrustMap @@ -72,9 +82,3 @@ trustSet uuid@(UUID _) level = do showLog showTrust . changeLog ts uuid level . parseLog parseTrust Annex.changeState $ \s -> s { Annex.trustmap = Nothing } trustSet NoUUID _ = error "unknown UUID; cannot modify trust level" - -{- Partitions a list of UUIDs to those matching a TrustLevel and not. -} -trustPartition :: TrustLevel -> [UUID] -> Annex ([UUID], [UUID]) -trustPartition level ls = do - candidates <- trustGet level - return $ partition (`elem` candidates) ls |