/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 bzrlib/log.py

  • Committer: Aaron Bentley
  • Date: 2008-03-24 13:26:42 UTC
  • mto: This revision was merged to the branch mainline in revision 3303.
  • Revision ID: aaron@aaronbentley.com-20080324132642-fddmh8rwk9py3uxm
Split out _iter_revision, allow view_revisions to be an iterator

Show diffs side-by-side

added added

removed removed

Lines of Context:
188
188
    finally:
189
189
        branch.unlock()
190
190
 
 
191
 
191
192
def _show_log(branch,
192
193
             lf,
193
194
             specific_fileid=None,
256
257
 
257
258
    generate_delta = verbose and getattr(lf, 'supports_delta', False)
258
259
 
259
 
    def iter_revisions():
260
 
        # r = revision, n = revno, d = merge depth
261
 
        revision_ids = [r for r, n, d in view_revisions]
262
 
        num = 9
263
 
        repository = branch.repository
264
 
        while revision_ids:
265
 
            cur_deltas = {}
266
 
            revisions = repository.get_revisions(revision_ids[:num])
267
 
            if generate_delta:
268
 
                deltas = repository.get_deltas_for_revisions(revisions)
269
 
                cur_deltas = dict(izip((r.revision_id for r in revisions),
270
 
                                       deltas))
271
 
            for revision in revisions:
272
 
                yield revision, cur_deltas.get(revision.revision_id)
273
 
            revision_ids  = revision_ids[num:]
274
 
            num = min(int(num * 1.5), 200)
275
 
 
276
260
    # now we just print all the revisions
277
261
    log_count = 0
278
 
    for ((rev_id, revno, merge_depth), (rev, delta)) in \
279
 
         izip(view_revisions, iter_revisions()):
280
 
 
 
262
    for (rev_id, revno, merge_depth), rev, delta in _iter_revisions(
 
263
        branch.repository, view_revisions, generate_delta):
281
264
        if searchRE:
282
265
            if not searchRE.search(rev.message):
283
266
                continue
291
274
                break
292
275
 
293
276
 
 
277
def _iter_revisions(repository, view_revisions, generate_delta):
 
278
    num = 9
 
279
    view_revisions = iter(view_revisions)
 
280
    while True:
 
281
        cur_view_revisions = [d for x, d in zip(range(num), view_revisions)]
 
282
        if len(cur_view_revisions) == 0:
 
283
            break
 
284
        cur_deltas = {}
 
285
        # r = revision, n = revno, d = merge depth
 
286
        revision_ids = [r for (r, n, d) in cur_view_revisions]
 
287
        revisions = repository.get_revisions(revision_ids)
 
288
        if generate_delta:
 
289
            deltas = repository.get_deltas_for_revisions(revisions)
 
290
            cur_deltas = dict(izip((r.revision_id for r in revisions),
 
291
                                   deltas))
 
292
        for view_data, revision in izip(cur_view_revisions, revisions):
 
293
            yield view_data, revision, cur_deltas.get(revision.revision_id)
 
294
        num = min(int(num * 1.5), 200)
 
295
 
 
296
 
294
297
def _get_mainline_revs(branch, start_revision, end_revision):
295
298
    """Get the mainline revisions from the branch.
296
299