add a UUID type

Should have done this a long time ago.
This commit is contained in:
Joey Hess 2011-11-07 14:46:01 -04:00
parent b08f7c428b
commit 63a292324d
18 changed files with 67 additions and 55 deletions

View file

@ -62,7 +62,7 @@ drawMap rs umap ts = Dot.graph $ repos ++ trusted ++ others
others = map (unreachable . uuidnode) $
filter (`notElem` ruuids) (M.keys umap)
trusted = map (trustworthy . uuidnode) ts
uuidnode u = Dot.graphNode u $ M.findWithDefault "" u umap
uuidnode u = Dot.graphNode (show u) $ M.findWithDefault "" u umap
hostname :: Git.Repo -> String
hostname r
@ -76,7 +76,7 @@ basehostname r = head $ split "." $ hostname r
- or the remote name if not. -}
repoName :: M.Map UUID String -> Git.Repo -> String
repoName umap r
| null repouuid = fallback
| repouuid == NoUUID = fallback
| otherwise = M.findWithDefault fallback repouuid umap
where
repouuid = getUncachedUUID r
@ -86,8 +86,8 @@ repoName umap r
nodeId :: Git.Repo -> String
nodeId r =
case getUncachedUUID r of
"" -> Git.repoLocation r
u -> u
NoUUID -> Git.repoLocation r
UUID u -> u
{- A node representing a repo. -}
node :: M.Map UUID String -> [Git.Repo] -> Git.Repo -> String