~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/graph.py

  • Committer: Aaron Bentley
  • Date: 2007-06-19 14:49:06 UTC
  • mto: This revision was merged to the branch mainline in revision 2537.
  • Revision ID: abentley@panoramicfeedback.com-20070619144906-zx160g6h377j729h
Fix handling of null revision

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
 
17
from bzrlib import errors
17
18
from bzrlib.deprecated_graph import (node_distances, select_farthest)
18
19
from bzrlib.revision import NULL_REVISION
19
20
 
46
47
    def __init__(self, parent_providers):
47
48
        self._parent_providers = parent_providers
48
49
 
 
50
    def __repr__(self):
 
51
        return "_StackedParentsProvider(%r)" % self._parent_providers
 
52
 
49
53
    def get_parents(self, revision_ids):
50
54
        """Find revision ids of the parents of a list of revisions
51
55
 
88
92
            conforming to the behavior of StackedParentsProvider.get_parents
89
93
        """
90
94
        self.get_parents = parents_provider.get_parents
 
95
        self.parents_provider = parents_provider
 
96
 
 
97
    def __repr__(self):
 
98
        return 'Graph(%r)' % self.parents_provider
91
99
 
92
100
    def find_lca(self, *revisions):
93
101
        """Determine the lowest common ancestors of the provided revisions
149
157
        This allows calculation of graph difference from the results of this
150
158
        operation.
151
159
        """
 
160
        if None in revisions:
 
161
            raise errors.InvalidRevisionId(None, self)
152
162
        common_searcher = self._make_breadth_first_searcher([])
153
163
        common_ancestors = set()
154
164
        searchers = [self._make_breadth_first_searcher([r])