/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to viz/linegraph.py

  • Committer: Jelmer Vernooij
  • Date: 2007-10-31 02:18:28 UTC
  • Revision ID: jelmer@samba.org-20071031021828-8xid6b5xmv1p8d53
Make broken_line_length setting from higher up.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
from bzrlib.tsort import merge_sort
13
13
 
14
 
def linegraph(repository, start, maxnum):
 
14
def linegraph(repository, start, maxnum, broken_line_length=None):
15
15
    """Produce a directed graph of a bzr repository.
16
16
 
17
17
    Returns a tuple of (line_graph, revid_index, columns_len) where
41
41
    curved, kinked, etc.) and to pick the actual colours for each index.
42
42
    """
43
43
    
44
 
    # FIXME: This should be configurable
45
 
    BROKEN_LINE_LENGTH = 32
46
 
    
47
44
    graph_parents = repository.get_revision_graph(start)
48
45
    graph_children = {}
49
46
    for revid in graph_parents.iterkeys():
150
147
        last_rev_index = None
151
148
        for rev_index in branch_line:
152
149
            if last_rev_index:
153
 
                if BROKEN_LINE_LENGTH and \
154
 
                   rev_index - last_rev_index > BROKEN_LINE_LENGTH:
 
150
                if broken_line_length and \
 
151
                   rev_index - last_rev_index > broken_line_length:
155
152
                    line_range.append(last_rev_index+1)
156
153
                    line_range.append(rev_index-1)
157
154
                else:
161
158
            last_rev_index = rev_index
162
159
        
163
160
        if parent_index:
164
 
            if BROKEN_LINE_LENGTH and \
165
 
               parent_index - last_rev_index > BROKEN_LINE_LENGTH:
 
161
            if broken_line_length and \
 
162
               parent_index - last_rev_index > broken_line_length:
166
163
                line_range.append(last_rev_index+1)
167
164
            else:
168
165
                line_range.extend(range(last_rev_index+1, parent_index))
202
199
                        
203
200
                    # If this line is really long, break it.
204
201
                    if len(branch_id) > 0 and \
205
 
                       BROKEN_LINE_LENGTH and \
206
 
                       parent_index - rev_index > BROKEN_LINE_LENGTH:
 
202
                       broken_line_length and \
 
203
                       parent_index - rev_index > broken_line_length:
207
204
                        child_line_col_index = \
208
205
                            _find_free_column(columns,
209
206
                                              empty_column,