~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Robert Collins
  • Date: 2006-07-04 17:23:00 UTC
  • mto: This revision was merged to the branch mainline in revision 1840.
  • Revision ID: robertc@robertcollins.net-20060704172300-c4af39f04babcab8
(robertc) Teach repository.get_revision_graph, and revision.common_ancestor, about NULL_REVISION.

Show diffs side-by-side

added added

removed removed

Lines of Context:
466
466
    def get_revision_graph(self, revision_id=None):
467
467
        """Return a dictionary containing the revision graph.
468
468
        
 
469
        :param revision_id: The revision_id to get a graph from. If None, then
 
470
        the entire revision graph is returned. This is a deprecated mode of
 
471
        operation and will be removed in the future.
469
472
        :return: a dictionary of revision_id->revision_parents_list.
470
473
        """
 
474
        # special case NULL_REVISION
 
475
        if revision_id == NULL_REVISION:
 
476
            return {}
471
477
        weave = self.get_inventory_weave()
472
478
        all_revisions = self._eliminate_revisions_not_present(weave.versions())
473
479
        entire_graph = dict([(node, weave.get_parents(node)) for 
501
507
            required = set([])
502
508
        else:
503
509
            pending = set(revision_ids)
504
 
            required = set(revision_ids)
 
510
            # special case NULL_REVISION
 
511
            if NULL_REVISION in pending:
 
512
                pending.remove(NULL_REVISION)
 
513
            required = set(pending)
505
514
        done = set([])
506
515
        while len(pending):
507
516
            revision_id = pending.pop()
873
882
    @needs_read_lock
874
883
    def get_revision_graph(self, revision_id=None):
875
884
        """Return a dictionary containing the revision graph.
876
 
        
 
885
 
 
886
        :param revision_id: The revision_id to get a graph from. If None, then
 
887
        the entire revision graph is returned. This is a deprecated mode of
 
888
        operation and will be removed in the future.
877
889
        :return: a dictionary of revision_id->revision_parents_list.
878
890
        """
 
891
        # special case NULL_REVISION
 
892
        if revision_id == NULL_REVISION:
 
893
            return {}
879
894
        weave = self._get_revision_vf()
880
895
        entire_graph = weave.get_graph()
881
896
        if revision_id is None:
909
924
            required = set([])
910
925
        else:
911
926
            pending = set(revision_ids)
912
 
            required = set(revision_ids)
 
927
            # special case NULL_REVISION
 
928
            if NULL_REVISION in pending:
 
929
                pending.remove(NULL_REVISION)
 
930
            required = set(pending)
913
931
        done = set([])
914
932
        while len(pending):
915
933
            revision_id = pending.pop()