show trusted repos in green

This commit is contained in:
Joey Hess 2011-02-08 18:04:19 -04:00
parent 3ae654254d
commit c0ec5a35db

View file

@ -21,6 +21,7 @@ import Messages
import Types import Types
import Utility import Utility
import UUID import UUID
import Trust
import qualified Dot import qualified Dot
-- a link from the first repository to the second (its remote) -- a link from the first repository to the second (its remote)
@ -38,8 +39,9 @@ start = do
rs <- spider g rs <- spider g
umap <- uuidMap umap <- uuidMap
trusted <- trustGet Trusted
liftIO $ writeFile file (drawMap rs umap) liftIO $ writeFile file (drawMap rs umap trusted)
showLongNote $ "running: dot -Tx11 " ++ file showLongNote $ "running: dot -Tx11 " ++ file
showProgress showProgress
r <- liftIO $ boolSystem "dot" ["-Tx11", file] r <- liftIO $ boolSystem "dot" ["-Tx11", file]
@ -56,14 +58,15 @@ start = do
- the repositories first, followed by uuids that were not matched - the repositories first, followed by uuids that were not matched
- to a repository. - to a repository.
-} -}
drawMap :: [Git.Repo] -> (M.Map UUID String) -> String drawMap :: [Git.Repo] -> (M.Map UUID String) -> [UUID] -> String
drawMap rs umap = Dot.graph $ repos ++ others drawMap rs umap ts = Dot.graph $ repos ++ trusted ++ others
where where
repos = map (node umap rs) rs repos = map (node umap rs) rs
ruuids = map getUncachedUUID rs ruuids = ts ++ map getUncachedUUID rs
others = map uuidnode $ filter (`notElem` ruuids) (M.keys umap) others = map (unreachable . uuidnode) $
uuidnode u = unreachable $ filter (`notElem` ruuids) (M.keys umap)
Dot.graphNode u $ M.findWithDefault "" u umap trusted = map (trustworthy . uuidnode) ts
uuidnode u = Dot.graphNode u $ M.findWithDefault "" u umap
hostname :: Git.Repo -> String hostname :: Git.Repo -> String
hostname r hostname r
@ -130,6 +133,8 @@ unreachable :: String -> String
unreachable = Dot.fillColor "red" unreachable = Dot.fillColor "red"
reachable :: String -> String reachable :: String -> String
reachable = Dot.fillColor "white" reachable = Dot.fillColor "white"
trustworthy :: String -> String
trustworthy = Dot.fillColor "green"
{- Recursively searches out remotes starting with the specified repo. -} {- Recursively searches out remotes starting with the specified repo. -}
spider :: Git.Repo -> Annex [Git.Repo] spider :: Git.Repo -> Annex [Git.Repo]