From 9b71b5f26c158973ca2d60dccde38290a1c9e6ad Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 16 Nov 2011 00:01:07 -0400 Subject: fix display of semitrusted repos in status semitrusted uuids rarely are listed in trust.log, so a special case is needed to get a list of them. Take the difference of all known uuids with non-semitrusted uuids. --- Command/Status.hs | 2 +- Logs/Trust.hs | 5 +++++ Logs/UUID.hs | 6 +++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Command/Status.hs b/Command/Status.hs index 2c0afa62c..47b500b90 100644 --- a/Command/Status.hs +++ b/Command/Status.hs @@ -102,7 +102,7 @@ supported_remote_types = stat "supported remote types" $ remote_list :: TrustLevel -> String -> Stat remote_list level desc = stat n $ lift $ do - us <- M.keys <$> uuidMap + us <- uuidList rs <- fst <$> trustPartition level us s <- prettyPrintUUIDs n rs return $ if null s then "0" else show (length rs) ++ "\n" ++ init s diff --git a/Logs/Trust.hs b/Logs/Trust.hs index cb91861fd..6305d281f 100644 --- a/Logs/Trust.hs +++ b/Logs/Trust.hs @@ -20,6 +20,7 @@ import Types.TrustLevel import qualified Annex.Branch import qualified Annex import Logs.UUIDBased +import Logs.UUID {- Filename of trust.log. -} trustLog :: FilePath @@ -27,6 +28,10 @@ trustLog = "trust.log" {- Returns a list of UUIDs at the specified trust level. -} trustGet :: TrustLevel -> Annex [UUID] +trustGet SemiTrusted = do -- special case; trustMap does not contain all these + others <- M.keys . M.filter (/= SemiTrusted) <$> trustMap + all <- uuidList + return $ all \\ others trustGet level = M.keys . M.filter (== level) <$> trustMap {- Read the trustLog into a map, overriding with any diff --git a/Logs/UUID.hs b/Logs/UUID.hs index 20f43d15c..17b0330c1 100644 --- a/Logs/UUID.hs +++ b/Logs/UUID.hs @@ -16,7 +16,8 @@ module Logs.UUID ( describeUUID, recordUUID, - uuidMap + uuidMap, + uuidList ) where import qualified Data.Map as M @@ -87,3 +88,6 @@ uuidMap = do return $ M.insertWith' preferold u "" m where preferold = flip const + +uuidList :: Annex [UUID] +uuidList = M.keys <$> uuidMap -- cgit v1.2.3