/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: Jelmer Vernooij
  • Date: 2007-11-05 04:26:47 UTC
  • mto: (0.140.11 stats)
  • mto: This revision was merged to the branch mainline in revision 6646.
  • Revision ID: jelmer@samba.org-20071105042647-uy2ol9aeyngrtcjo
Split out functionality that sorts revids by commmitter.

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
            for revs, email, fname in counter_to_info.values()), reverse=True)
86
86
 
87
87
 
 
88
def sort_by_committer(a_repo, revids):
 
89
    committers = {}
 
90
    pb = bzrlib.ui.ui_factory.nested_progress_bar()
 
91
    try:
 
92
        pb.note('getting revisions')
 
93
        revisions = a_repo.get_revisions(revids)
 
94
        for count, rev in enumerate(revisions):
 
95
            pb.update('checking', count, len(revids))
 
96
            try:
 
97
                email = extract_email_address(rev.committer)
 
98
            except errors.BzrError:
 
99
                email = rev.committer
 
100
            committers.setdefault(email, []).append(rev)
 
101
    finally:
 
102
        pb.finished()
 
103
    
 
104
    return committers
 
105
 
 
106
 
88
107
def get_info(a_repo, revision):
89
108
    """Get all of the information for a particular revision"""
90
109
    pb = bzrlib.ui.ui_factory.nested_progress_bar()
91
 
    committers = {}
92
110
    a_repo.lock_read()
93
111
    try:
94
112
        pb.note('getting ancestry')
95
113
        ancestry = a_repo.get_ancestry(revision)[1:]
96
 
        pb.note('getting revisions')
97
 
        revisions = a_repo.get_revisions(ancestry)
98
114
 
99
 
        for count, rev in enumerate(revisions):
100
 
            pb.update('checking', count, len(ancestry))
101
 
            try:
102
 
                email = extract_email_address(rev.committer)
103
 
            except errors.BzrError:
104
 
                email = rev.committer
105
 
            committers.setdefault(email, []).append(rev)
 
115
        committers = sort_by_committer(a_repo, ancestry)
106
116
    finally:
107
117
        a_repo.unlock()
108
118
        pb.finished()
109
119
 
110
 
    info = collapse_by_author(committers)
111
 
    return info
 
120
    return collapse_by_author(committers)
112
121
 
113
122
 
114
123
def get_diff_info(a_repo, start_rev, end_rev):