~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/wholehistory.py

  • Committer: Martin Pool
  • Date: 2009-03-10 01:01:04 UTC
  • mto: This revision was merged to the branch mainline in revision 298.
  • Revision ID: mbp@sourcefrog.net-20090310010104-o75ncguznrridwaz
optparse may have already parsed port as an int

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
 
38
38
 
39
39
def compute_whole_history_data(branch):
40
 
    """Compute _rev_info and _rev_indices for a branch.
41
 
 
42
 
    See History.__doc__ for what these data structures mean.
43
 
    """
44
40
    z = time.time()
45
41
 
46
42
    last_revid = branch.last_revision()
54
50
 
55
51
    _revision_graph = _strip_NULL_ghosts(parent_map)
56
52
    _full_history = []
57
 
 
58
 
    _rev_info = []
59
 
    _rev_indices = {}
60
 
 
 
53
    _revision_info = {}
 
54
    _revno_revid = {}
61
55
    if is_null(last_revid):
62
56
        _merge_sort = []
63
57
    else:
64
58
        _merge_sort = merge_sort(
65
59
            _revision_graph, last_revid, generate_revno=True)
66
60
 
67
 
    for info in _merge_sort:
68
 
        seq, revid, merge_depth, revno, end_of_merge = info
 
61
    for (seq, revid, merge_depth, revno, end_of_merge) in _merge_sort:
69
62
        _full_history.append(revid)
70
63
        revno_str = '.'.join(str(n) for n in revno)
71
 
        parents = _revision_graph[revid]
72
 
        _rev_indices[revid] = len(_rev_info)
73
 
        _rev_info.append([(seq, revid, merge_depth, revno_str, end_of_merge), (), parents])
 
64
        _revno_revid[revno_str] = revid
 
65
        _revision_info[revid] = (
 
66
            seq, revid, merge_depth, revno_str, end_of_merge)
 
67
 
 
68
    _where_merged = {}
74
69
 
75
70
    for revid in _revision_graph.keys():
76
 
        if _rev_info[_rev_indices[revid]][0][2] == 0:
 
71
        if _revision_info[revid][2] == 0:
77
72
            continue
78
73
        for parent in _revision_graph[revid]:
79
 
            c = _rev_info[_rev_indices[parent]]
80
 
            if revid not in c[1]:
81
 
                c[1] = c[1] + (revid,)
 
74
            _where_merged.setdefault(parent, set()).add(revid)
82
75
 
83
76
    log.info('built revision graph cache: %r secs' % (time.time() - z))
84
77
 
85
 
    return (_rev_info, _rev_indices)
 
78
    return (_revision_graph, _full_history, _revision_info,
 
79
            _revno_revid, _merge_sort, _where_merged)