darcs2dot 0.1.0.0 → 0.1.0.1
raw patch · 2 files changed
+9/−5 lines, 2 filesdep ~basedep ~containersdep ~string-conversions
Dependency ranges changed: base, containers, string-conversions
Files
- darcs2dot.cabal +4/−4
- darcs2dot.hs +5/−1
darcs2dot.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: darcs2dot-version: 0.1.0.0+version: 0.1.0.1 synopsis: Outputs dependencies of darcs patches in dot format. description: Outputs dependencies of darcs patches in dot format. Just run darcs2dot in a darcs repo and it will output (the transitive reduction of) the dependencies of the patches in dot format to stdout.@@ -27,9 +27,9 @@ executable darcs2dot main-is: darcs2dot.hs build-depends:- base ==4.5.*,+ base == 4.5.* || == 4.6.*, darcs == 2.8.*,- string-conversions == 0.2.*,- containers == 0.4.*,+ string-conversions == 0.2.* || == 0.3.*,+ containers == 0.4.* || == 0.5.*, graph-wrapper == 0.2.*
darcs2dot.hs view
@@ -82,12 +82,16 @@ toDot :: (Ord i) => Graph i String -> String toDot graph = "digraph g {\n" ++- (concatMap inner $ toList $ fmap (take 15) $ transitiveReduction $ indexToInt graph) +++ (concatMap inner $ toList $ fmap (escapeQuotes . take 15) $+ transitiveReduction $ indexToInt graph) ++ "}\n" where inner (i, name, outgoing) = printf " %i [label = \"%s\"];\n" i name ++ concatMap (\ out -> printf " %i -> %i;\n" i out) outgoing++ escapeQuotes :: String -> String+ escapeQuotes = concatMap (\ c -> if c == '\"' then "\\\"" else [c]) -- | convert indices to Ints indexToInt :: forall i v . Ord i => Graph i v -> Graph Int v