~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to graph.py

  • Committer: aaron.bentley at utoronto
  • Date: 2005-09-04 00:38:06 UTC
  • Revision ID: aaron.bentley@utoronto.ca-20050904003806-394210c180f0bc98
Reduced graph-collapsing aggressivness

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
        return committer
35
35
    return new_committer
36
36
 
 
37
def can_skip(rev_id, descendants, ancestors):
 
38
    if rev_id not in descendants:
 
39
        return False
 
40
    elif len(ancestors[rev_id]) != 1:
 
41
        return False
 
42
    elif len(descendants[ancestors[rev_id][0]]) != 1:
 
43
        return False
 
44
    elif len(descendants[rev_id]) != 1:
 
45
        return False
 
46
    else:
 
47
        return True
37
48
 
38
49
def compact_descendants(descendants, ancestors):
39
50
    new_descendants={}
44
55
        new_descendants[me] = []
45
56
        for descendant in my_descendants:
46
57
            new_descendant = descendant
47
 
            while new_descendant in descendants and \
48
 
                len(ancestors[new_descendant]) == 1 and \
49
 
                len(descendants[new_descendant]) == 1:
 
58
            while can_skip(new_descendant, descendants, ancestors):
50
59
                skip.add(new_descendant)
51
60
                if new_descendant in new_descendants:
52
61
                    del new_descendants[new_descendant]