~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Aaron Bentley
  • Date: 2007-02-14 20:28:01 UTC
  • mto: This revision was merged to the branch mainline in revision 2290.
  • Revision ID: abentley@panoramicfeedback.com-20070214202801-ur4lw9vhwey5fn2z
Move reverse history iteration to repository

Show diffs side-by-side

added added

removed removed

Lines of Context:
644
644
            done.add(revision_id)
645
645
        return result
646
646
 
 
647
    def _get_history_vf(self):
 
648
        """Get a versionedfile whose history graph reflects all revisions.
 
649
 
 
650
        For weave repositories, this is the inventory weave.
 
651
        """
 
652
        return self.get_inventory_weave()
 
653
 
 
654
    def iter_reverse_revision_history(self, revision_id):
 
655
        """Iterate backwards through revision ids in the lefthand history
 
656
 
 
657
        :param revision_id: The revision id to start with.  All its lefthand
 
658
            ancestors will be traversed.
 
659
        """
 
660
        if revision_id in (None, _mod_revision.NULL_REVISION):
 
661
            return
 
662
        next_id = revision_id
 
663
        versionedfile = self._get_history_vf()
 
664
        while True:
 
665
            yield next_id
 
666
            parents = versionedfile.get_parents(next_id)
 
667
            if len(parents) == 0:
 
668
                return
 
669
            else:
 
670
                next_id = parents[0]
 
671
 
647
672
    @needs_read_lock
648
673
    def get_revision_inventory(self, revision_id):
649
674
        """Return inventory of a past revision."""