~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to graph.py

  • Committer: Aaron Bentley
  • Date: 2005-09-01 14:11:13 UTC
  • Revision ID: abentley@panoramicfeedback.com-20050901141113-bc37c80383a77aaf
Tweaked missing-dot handling

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
from dotgraph import Node, dot_output, invoke_dot
 
1
from dotgraph import Node, dot_output, invoke_dot, NoDot
2
2
from bzrlib.branch import Branch
 
3
from bzrlib.errors import BzrCommandError
3
4
import bzrlib.errors
4
5
import re
5
6
 
97
98
    relations = graph_ancestry(b, collapse)
98
99
    ext = filename.split('.')[-1]
99
100
    if ext in ('svg', 'svgz', 'gif', 'jpg', 'ps', 'fig', 'mif', 'png'):
100
 
        invoke_dot(dot_output(relations), filename, ext)
 
101
        try:
 
102
            invoke_dot(dot_output(relations), filename, ext)
 
103
        except NoDot, e:
 
104
            raise BzrCommandError("Can't find 'dot'.  Please ensure Graphviz"\
 
105
                " is installed correctly.")
101
106
    elif ext=='dot':
102
107
        file(filename, 'wb').write("".join(list(dot_output(relations))))
103
108
    else: