~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-03-26 03:06:52 UTC
  • mfrom: (3287.5.10 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20080326030652-vgwdkwda9mi8s200
Deprecate VersionedFile.get_parents. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1607
1607
            done.add(revision_id)
1608
1608
        return result
1609
1609
 
1610
 
    def _get_history_vf(self):
1611
 
        """Get a versionedfile whose history graph reflects all revisions.
1612
 
 
1613
 
        For weave repositories, this is the inventory weave.
1614
 
        """
1615
 
        return self.get_inventory_weave()
1616
 
 
1617
1610
    def iter_reverse_revision_history(self, revision_id):
1618
1611
        """Iterate backwards through revision ids in the lefthand history
1619
1612
 
1620
1613
        :param revision_id: The revision id to start with.  All its lefthand
1621
1614
            ancestors will be traversed.
1622
1615
        """
1623
 
        if revision_id in (None, _mod_revision.NULL_REVISION):
1624
 
            return
 
1616
        graph = self.get_graph()
1625
1617
        next_id = revision_id
1626
 
        versionedfile = self._get_history_vf()
1627
1618
        while True:
 
1619
            if next_id in (None, _mod_revision.NULL_REVISION):
 
1620
                return
1628
1621
            yield next_id
1629
 
            parents = versionedfile.get_parents(next_id)
 
1622
            # Note: The following line may raise KeyError in the event of
 
1623
            # truncated history. We decided not to have a try:except:raise
 
1624
            # RevisionNotPresent here until we see a use for it, because of the
 
1625
            # cost in an inner loop that is by its very nature O(history).
 
1626
            # Robert Collins 20080326
 
1627
            parents = graph.get_parent_map([next_id])[next_id]
1630
1628
            if len(parents) == 0:
1631
1629
                return
1632
1630
            else:
3124
3122
        """
3125
3123
        wrong_parents = {}
3126
3124
        unused_versions = set()
3127
 
        for num, revision_id in enumerate(weave.versions()):
 
3125
        versions = weave.versions()
 
3126
        parent_map = weave.get_parent_map(versions)
 
3127
        for num, revision_id in enumerate(versions):
3128
3128
            try:
3129
3129
                correct_parents = self.calculate_file_version_parents(
3130
3130
                    revision_id, file_id)
3133
3133
                unused_versions.add(revision_id)
3134
3134
            else:
3135
3135
                try:
3136
 
                    knit_parents = tuple(weave.get_parents(revision_id))
 
3136
                    knit_parents = tuple(parent_map[revision_id])
3137
3137
                except errors.RevisionNotPresent:
3138
3138
                    knit_parents = None
3139
3139
                if correct_parents != knit_parents: