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.
This commit is contained in:
parent
e83b966eb5
commit
9b71b5f26c
3 changed files with 11 additions and 2 deletions
|
@ -102,7 +102,7 @@ supported_remote_types = stat "supported remote types" $
|
||||||
|
|
||||||
remote_list :: TrustLevel -> String -> Stat
|
remote_list :: TrustLevel -> String -> Stat
|
||||||
remote_list level desc = stat n $ lift $ do
|
remote_list level desc = stat n $ lift $ do
|
||||||
us <- M.keys <$> uuidMap
|
us <- uuidList
|
||||||
rs <- fst <$> trustPartition level us
|
rs <- fst <$> trustPartition level us
|
||||||
s <- prettyPrintUUIDs n rs
|
s <- prettyPrintUUIDs n rs
|
||||||
return $ if null s then "0" else show (length rs) ++ "\n" ++ init s
|
return $ if null s then "0" else show (length rs) ++ "\n" ++ init s
|
||||||
|
|
|
@ -20,6 +20,7 @@ import Types.TrustLevel
|
||||||
import qualified Annex.Branch
|
import qualified Annex.Branch
|
||||||
import qualified Annex
|
import qualified Annex
|
||||||
import Logs.UUIDBased
|
import Logs.UUIDBased
|
||||||
|
import Logs.UUID
|
||||||
|
|
||||||
{- Filename of trust.log. -}
|
{- Filename of trust.log. -}
|
||||||
trustLog :: FilePath
|
trustLog :: FilePath
|
||||||
|
@ -27,6 +28,10 @@ trustLog = "trust.log"
|
||||||
|
|
||||||
{- Returns a list of UUIDs at the specified trust level. -}
|
{- Returns a list of UUIDs at the specified trust level. -}
|
||||||
trustGet :: TrustLevel -> Annex [UUID]
|
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
|
trustGet level = M.keys . M.filter (== level) <$> trustMap
|
||||||
|
|
||||||
{- Read the trustLog into a map, overriding with any
|
{- Read the trustLog into a map, overriding with any
|
||||||
|
|
|
@ -16,7 +16,8 @@
|
||||||
module Logs.UUID (
|
module Logs.UUID (
|
||||||
describeUUID,
|
describeUUID,
|
||||||
recordUUID,
|
recordUUID,
|
||||||
uuidMap
|
uuidMap,
|
||||||
|
uuidList
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import qualified Data.Map as M
|
import qualified Data.Map as M
|
||||||
|
@ -87,3 +88,6 @@ uuidMap = do
|
||||||
return $ M.insertWith' preferold u "" m
|
return $ M.insertWith' preferold u "" m
|
||||||
where
|
where
|
||||||
preferold = flip const
|
preferold = flip const
|
||||||
|
|
||||||
|
uuidList :: Annex [UUID]
|
||||||
|
uuidList = M.keys <$> uuidMap
|
||||||
|
|
Loading…
Reference in a new issue