/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 branchview/linegraph.py

  • Committer: Martin Albisetti
  • Date: 2008-03-30 20:20:03 UTC
  • mfrom: (450.1.10 trunk)
  • Revision ID: argentina@gmail.com-20080330202003-615j8hm6jinbnf36
MergeĀ fromĀ trunk

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, broken_line_length = None,
 
14
def linegraph(repository, start_revs, maxnum, broken_line_length = None,
15
15
              graph_data = True, mainline_only = False):
16
16
    """Produce a directed graph of a bzr repository.
17
17
 
42
42
    curved, kinked, etc.) and to pick the actual colours for each index.
43
43
    """
44
44
    
45
 
    graph_parents = repository.get_revision_graph(start)
 
45
    graph = repository.get_graph()
 
46
    graph_parents = {}
46
47
    graph_children = {}
47
 
    for revid in graph_parents.iterkeys():
 
48
    for (revid, parent_revids) in graph.iter_ancestry(start_revs):
 
49
        graph_parents[revid] = parent_revids
48
50
        graph_children[revid] = []
49
51
 
 
52
    graph_parents["top:"] = start_revs
 
53
 
50
54
    if len(graph_parents)>0:
51
55
        merge_sorted_revisions = merge_sort(
52
56
            graph_parents,
53
 
            start,
 
57
            "top:",
54
58
            generate_revno=True)
55
59
    else:
56
60
        merge_sorted_revisions = ()
58
62
    if mainline_only:
59
63
        merge_sorted_revisions = [elem for elem in merge_sorted_revisions \
60
64
                                  if len(elem[3])==1 ]
 
65
 
 
66
    assert merge_sorted_revisions[0][1] == "top:"
 
67
    merge_sorted_revisions = merge_sorted_revisions[1:]
61
68
    
62
69
    revid_index = {}
63
70
    revno_index = {}