~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Martin Pool
  • Date: 2010-04-28 07:03:38 UTC
  • mfrom: (5188 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5189.
  • Revision ID: mbp@sourcefrog.net-20100428070338-2af8y3takgfkrkyp
merge news

Show diffs side-by-side

added added

removed removed

Lines of Context:
417
417
            * 'include' - the stop revision is the last item in the result
418
418
            * 'with-merges' - include the stop revision and all of its
419
419
              merged revisions in the result
420
 
            * 'with-merges-without-common-ancestry' - filter out revisions 
421
 
              that are in both ancestries
422
420
        :param direction: either 'reverse' or 'forward':
423
421
            * reverse means return the start_revision_id first, i.e.
424
422
              start at the most recent revision and go backwards in history
455
453
            stop_revision_id, stop_rule)
456
454
        # Make sure we don't return revisions that are not part of the
457
455
        # start_revision_id ancestry.
458
 
        filtered = self._filter_start_non_ancestors(filtered)
 
456
        filtered = self._filter_non_ancestors(filtered)
459
457
        if direction == 'reverse':
460
458
            return filtered
461
459
        if direction == 'forward':
498
496
                       node.end_of_merge)
499
497
                if rev_id == stop_revision_id:
500
498
                    return
501
 
        elif stop_rule == 'with-merges-without-common-ancestry':
502
 
            # We want to exclude all revisions that are already part of the
503
 
            # stop_revision_id ancestry.
504
 
            graph = self.repository.get_graph()
505
 
            ancestors = graph.find_unique_ancestors(start_revision_id,
506
 
                                                    [stop_revision_id])
507
 
            for node in rev_iter:
508
 
                rev_id = node.key[-1]
509
 
                if rev_id not in ancestors:
510
 
                    continue
511
 
                yield (rev_id, node.merge_depth, node.revno,
512
 
                       node.end_of_merge)
513
499
        elif stop_rule == 'with-merges':
514
500
            stop_rev = self.repository.get_revision(stop_revision_id)
515
501
            if stop_rev.parent_ids:
538
524
        else:
539
525
            raise ValueError('invalid stop_rule %r' % stop_rule)
540
526
 
541
 
    def _filter_start_non_ancestors(self, rev_iter):
 
527
    def _filter_non_ancestors(self, rev_iter):
542
528
        # If we started from a dotted revno, we want to consider it as a tip
543
529
        # and don't want to yield revisions that are not part of its
544
530
        # ancestry. Given the order guaranteed by the merge sort, we will see