~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: 2007-06-18 21:07:10 UTC
  • mfrom: (2490.2.27 graphwalker)
  • Revision ID: pqm@pqm.ubuntu.com-20070618210710-6y8wzcqiw2kvxdiy
Better merge base selection and graph API

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
from bzrlib import (
26
26
    bzrdir,
27
27
    check,
 
28
    deprecated_graph,
28
29
    errors,
29
30
    generate_ids,
30
31
    gpg,
703
704
        :param revision_ids: an iterable of revisions to graph or None for all.
704
705
        :return: a Graph object with the graph reachable from revision_ids.
705
706
        """
706
 
        result = graph.Graph()
 
707
        result = deprecated_graph.Graph()
707
708
        if not revision_ids:
708
709
            pending = set(self.all_revision_ids())
709
710
            required = set([])
862
863
        revision_id = osutils.safe_revision_id(revision_id)
863
864
        return self.get_inventory_weave().parent_names(revision_id)
864
865
 
 
866
    def get_parents(self, revision_ids):
 
867
        """See StackedParentsProvider.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(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 and
 
890
            other_repository.bzrdir.transport.base !=
 
891
            self.bzrdir.transport.base):
 
892
            parents_provider = graph._StackedParentsProvider(
 
893
                [parents_provider, other_repository._make_parents_provider()])
 
894
        return graph.Graph(parents_provider)
 
895
 
865
896
    @needs_write_lock
866
897
    def set_make_working_trees(self, new_value):
867
898
        """Set the policy flag for making working trees when creating branches.