/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: Javier Derderian
  • Date: 2008-04-11 20:34:06 UTC
  • mto: (465.1.1 gtk.patch)
  • mto: This revision was merged to the branch mainline in revision 466.
  • Revision ID: javierder@gmail.com-20080411203406-ftlwyodw9vr87olv
Updated "Compare with..." (#78765) to use revbrowser.RevisionBrowser.
Also needed to fix #215872 to make it work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
__copyright__ = "Copyright © 2005 Canonical Ltd."
10
10
__author__    = "Scott James Remnant <scott@ubuntu.com>"
11
11
 
12
 
from bzrlib.revision import NULL_REVISION
13
12
from bzrlib.tsort import merge_sort
14
13
 
15
14
def linegraph(repository, start_revs, maxnum, broken_line_length = None,
43
42
    curved, kinked, etc.) and to pick the actual colours for each index.
44
43
    """
45
44
    
 
45
    if type(start_revs) != list:
 
46
        start_revs = [start_revs]
 
47
        
46
48
    graph = repository.get_graph()
47
49
    graph_parents = {}
48
 
    ghosts = set()
49
50
    graph_children = {}
50
51
    for (revid, parent_revids) in graph.iter_ancestry(start_revs):
51
 
        if parent_revids is None:
52
 
            ghosts.add(revid)
53
 
            continue
54
 
        if parent_revids == (NULL_REVISION,):
55
 
            graph_parents[revid] = ()
56
 
        else:
57
 
            graph_parents[revid] = parent_revids
58
 
        for parent in parent_revids:
59
 
            graph_children.setdefault(parent, []).append(revid)
60
 
        graph_children.setdefault(revid, [])
61
 
    for ghost in ghosts:
62
 
        for ghost_child in graph_children[ghost]:
63
 
            graph_parents[ghost_child] = [p for p in graph_parents[ghost_child]
64
 
                                          if p not in ghosts]
 
52
        graph_parents[revid] = parent_revids
 
53
        graph_children[revid] = []
 
54
 
65
55
    graph_parents["top:"] = start_revs
66
56
 
67
57
    if len(graph_parents)>0:
103
93
        revid_index[revid] = rev_index
104
94
        
105
95
        parents = graph_parents[revid]
 
96
        for parent_revid in parents:
 
97
            graph_children[parent_revid].append(revid)
 
98
        
106
99
        linegraph.append([revid,
107
100
                          None,
108
101
                          [],