/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: Jelmer Vernooij
  • Date: 2008-04-25 20:03:44 UTC
  • mfrom: (463.3.1 bug.215350)
  • Revision ID: jelmer@samba.org-20080425200344-1s2gp5qnoq15fu1o
Merge fix for View Changes menu option.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
from bzrlib.revision import NULL_REVISION
13
13
from bzrlib.tsort import merge_sort
14
14
 
15
 
def linegraph(graph, start_revs, maxnum, broken_line_length = None,
 
15
def linegraph(repository, start_revs, maxnum, broken_line_length = None,
16
16
              graph_data = True, mainline_only = False):
17
17
    """Produce a directed graph of a bzr repository.
18
18
 
43
43
    curved, kinked, etc.) and to pick the actual colours for each index.
44
44
    """
45
45
    
 
46
    graph = repository.get_graph()
46
47
    graph_parents = {}
47
 
    ghosts = set()
48
48
    graph_children = {}
49
49
    for (revid, parent_revids) in graph.iter_ancestry(start_revs):
50
 
        if parent_revids is None:
51
 
            ghosts.add(revid)
52
 
            continue
53
50
        if parent_revids == (NULL_REVISION,):
54
51
            graph_parents[revid] = ()
55
52
        else:
56
53
            graph_parents[revid] = parent_revids
57
 
        for parent in parent_revids:
58
 
            graph_children.setdefault(parent, []).append(revid)
59
 
        graph_children.setdefault(revid, [])
60
 
    for ghost in ghosts:
61
 
        for ghost_child in graph_children[ghost]:
62
 
            graph_parents[ghost_child] = [p for p in graph_parents[ghost_child]
63
 
                                          if p not in ghosts]
 
54
        graph_children[revid] = []
 
55
 
64
56
    graph_parents["top:"] = start_revs
65
57
 
66
58
    if len(graph_parents)>0:
102
94
        revid_index[revid] = rev_index
103
95
        
104
96
        parents = graph_parents[revid]
 
97
        for parent_revid in parents:
 
98
            graph_children[parent_revid].append(revid)
 
99
        
105
100
        linegraph.append([revid,
106
101
                          None,
107
102
                          [],