~amanica/bzr/320119-log_exclusive_lower_bound

« back to all changes in this revision

Viewing changes to bzrlib/log.py

  • Committer: Marius Kruger
  • Date: 2009-08-03 13:27:23 UTC
  • Revision ID: amanic@gmail.com-20090803132723-zoas7j1oni042bj8
start adding optional exclusive_start params to api's

Show diffs side-by-side

added added

removed removed

Lines of Context:
488
488
 
489
489
 
490
490
def _calc_view_revisions(branch, start_rev_id, end_rev_id, direction,
491
 
    generate_merge_revisions, delayed_graph_generation=False):
 
491
    generate_merge_revisions, delayed_graph_generation=False,
 
492
    exclusive_start=False):
492
493
    """Calculate the revisions to view.
493
494
 
494
495
    :return: An iterator of (revision_id, dotted_revno, merge_depth) tuples OR
508
509
    # If we only want to see linear revisions, we can iterate ...
509
510
    if not generate_merge_revisions:
510
511
        return _generate_flat_revisions(branch, start_rev_id, end_rev_id,
511
 
            direction)
 
512
            direction, exclusive_start=exclusive_start)
512
513
    else:
513
514
        return _generate_all_revisions(branch, start_rev_id, end_rev_id,
514
 
            direction, delayed_graph_generation)
 
515
            direction, delayed_graph_generation,
 
516
            exclusive_start=exclusive_start)
515
517
 
516
518
 
517
519
def _generate_one_revision(branch, rev_id, br_rev_id, br_revno):
541
543
 
542
544
 
543
545
def _generate_all_revisions(branch, start_rev_id, end_rev_id, direction,
544
 
    delayed_graph_generation):
 
546
    delayed_graph_generation, exclusive_start=False):
545
547
    # On large trees, generating the merge graph can take 30-60 seconds
546
548
    # so we delay doing it until a merge is detected, incrementally
547
549
    # returning initial (non-merge) revisions while we can.
576
578
    # indented at the end seems slightly nicer in that case.
577
579
    view_revisions = chain(iter(initial_revisions),
578
580
        _graph_view_revisions(branch, start_rev_id, end_rev_id,
579
 
        rebase_initial_depths=direction == 'reverse'))
 
581
        rebase_initial_depths=direction == 'reverse'),
 
582
        exclusive_start=exclusive_start)
580
583
    if direction == 'reverse':
581
584
        return view_revisions
582
585
    elif direction == 'forward':
645
648
 
646
649
 
647
650
def _graph_view_revisions(branch, start_rev_id, end_rev_id,
648
 
    rebase_initial_depths=True):
 
651
    rebase_initial_depths=True, exclusive_start=False):
649
652
    """Calculate revisions to view including merges, newest to oldest.
650
653
 
651
654
    :param branch: the branch
655
658
      revision is found?
656
659
    :return: An iterator of (revision_id, dotted_revno, merge_depth) tuples.
657
660
    """
 
661
    if exclusive_start:
 
662
        stop_rule = "exclude-with-merges"
 
663
    else:
 
664
        stop_rule = "with-merges"
658
665
    view_revisions = branch.iter_merge_sorted_revisions(
659
666
        start_revision_id=end_rev_id, stop_revision_id=start_rev_id,
660
 
        stop_rule="exclude-with-merges")
 
667
        stop_rule=stop_rule)
661
668
    if not rebase_initial_depths:
662
669
        for (rev_id, merge_depth, revno, end_of_merge
663
670
             ) in view_revisions: