/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 breezy/plugins/stats/cmds.py

  • Committer: Jelmer Vernooij
  • Date: 2018-03-17 15:56:32 UTC
  • mto: This revision was merged to the branch mainline in revision 6892.
  • Revision ID: jelmer@jelmer.uk-20180317155632-0idvnys8wfbu3eev
Use itertools magic.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
from __future__ import absolute_import
19
19
 
 
20
import itertools
 
21
 
20
22
from ... import (
21
23
    branch,
22
24
    commands,
145
147
    combo_count = {}
146
148
    with ui.ui_factory.nested_progress_bar() as pb:
147
149
        trace.note('getting revisions')
148
 
        revisions = []
149
 
        for count, (revid, rev) in enumerate(a_repo.iter_revisions(revids)):
 
150
        revision_iters = itertools.tee(a_repo.iter_revisions(revids))
 
151
        for count, (revid, rev) in enumerate(revision_iters[0]):
150
152
            pb.update('checking', count, len(revids))
151
153
            for author in rev.get_apparent_authors():
152
154
                # XXX: There is a chance sometimes with svn imports that the
155
157
                email_users.setdefault(email, set()).add(username)
156
158
                combo = (username, email)
157
159
                combo_count[combo] = combo_count.setdefault(combo, 0) + 1
158
 
            revisions.append(rev)
159
 
    return revisions, collapse_email_and_users(email_users, combo_count)
 
160
    return ((rev for (revid, rev) in revision_iters[1]),
 
161
            collapse_email_and_users(email_users, combo_count))
160
162
 
161
163
 
162
164
def get_info(a_repo, revision):