summaryrefslogtreecommitdiff
path: root/Command/Map.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-02-04 00:13:47 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-02-04 00:13:47 -0400
commit926df3d91ec29f35e2cdf3df0d286721f40b9cbf (patch)
tree1126945aeee6c4c9975c1ed73f4e4b550d90f4f3 /Command/Map.hs
parent0fd0e414ec593dcb965ca9a348798857be2bb3e9 (diff)
node ordering
Diffstat (limited to 'Command/Map.hs')
-rw-r--r--Command/Map.hs17
1 files changed, 12 insertions, 5 deletions
diff --git a/Command/Map.hs b/Command/Map.hs
index bc117d479..83207d551 100644
--- a/Command/Map.hs
+++ b/Command/Map.hs
@@ -49,12 +49,19 @@ start = do
{- Generates a graph for dot(1). Each repository, and any other uuids, are
- displayed as a node, and each of its remotes is represented as an edge
- - pointing at the node for the remote. -}
+ - pointing at the node for the remote.
+ -
+ - The order nodes are added to the graph matters, since dot will draw
+ - the first ones near to the top and left. So it looks better to put
+ - the repositories first, followed by uuids that were not matched
+ - to a repository.
+ -}
drawMap :: [Git.Repo] -> (M.Map UUID String) -> String
-drawMap rs umap = Dot.graph $ others ++ repos
+drawMap rs umap = Dot.graph $ repos ++ others
where
repos = map (node umap rs) rs
- others = map uuidnode (M.keys umap)
+ ruuids = map getUncachedUUID rs
+ others = map uuidnode $ filter (`notElem` ruuids) (M.keys umap)
uuidnode u = unreachable $
Dot.graphNode u $ M.findWithDefault "" u umap
@@ -120,9 +127,9 @@ edge umap fullinfo from to =
else Just n
unreachable :: String -> String
-unreachable s = Dot.fillColor "red" s
+unreachable = Dot.fillColor "red"
reachable :: String -> String
-reachable s = Dot.fillColor "white" s
+reachable = Dot.fillColor "white"
{- Recursively searches out remotes starting with the specified repo. -}
spider :: Git.Repo -> Annex [Git.Repo]