~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Aaron Bentley
  • Date: 2007-06-08 15:03:32 UTC
  • mto: This revision was merged to the branch mainline in revision 2534.
  • Revision ID: abentley@panoramicfeedback.com-20070608150332-jxt1yx9hy7dmhxhv
Update distinct -> lowest, refactor, add ParentsProvider concept

Show diffs side-by-side

added added

removed removed

Lines of Context:
735
735
            done.add(revision_id)
736
736
        return result
737
737
 
738
 
    def get_graph_walker(self, other_repository=None):
739
 
        """Return the graph walker for this repository format"""
740
 
        graphs = [self.get_revision_graph_with_ghosts()]
741
 
        if other_repository is not None:
742
 
            graphs.append(other_repository.get_revision_graph_with_ghosts())
743
 
        return graph_walker.GraphWalker(graphs)
744
 
 
745
738
    def _get_history_vf(self):
746
739
        """Get a versionedfile whose history graph reflects all revisions.
747
740
 
870
863
        revision_id = osutils.safe_revision_id(revision_id)
871
864
        return self.get_inventory_weave().parent_names(revision_id)
872
865
 
 
866
    def get_parents(self, revision_ids):
 
867
        """See GraphWalker.get_parents"""
 
868
        parents_list = []
 
869
        for revision_id in revision_ids:
 
870
            if revision_id == _mod_revision.NULL_REVISION:
 
871
                parents = []
 
872
            else:
 
873
                try:
 
874
                    parents = self.get_revision(revision_id).parent_ids
 
875
                except errors.NoSuchRevision:
 
876
                    parents = None
 
877
                else:
 
878
                    if len(parents) == 0:
 
879
                        parents = [_mod_revision.NULL_REVISION]
 
880
            parents_list.append(parents)
 
881
        return parents_list
 
882
 
 
883
    def _make_parents_provider(self):
 
884
        return self
 
885
 
 
886
    def get_graph_walker(self, other_repository=None):
 
887
        """Return the graph walker for this repository format"""
 
888
        parents_provider = self._make_parents_provider()
 
889
        if other_repository is not None:
 
890
            parents_provider = graph_walker._StackedParentsProvider(
 
891
                [parents_provider, other_repository._make_parents_provider()])
 
892
        return graph_walker.GraphWalker(parents_provider)
 
893
 
873
894
    @needs_write_lock
874
895
    def set_make_working_trees(self, new_value):
875
896
        """Set the policy flag for making working trees when creating branches.