~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/graph.py

  • Committer: Andrew Bennetts
  • Date: 2011-05-04 02:34:05 UTC
  • mto: This revision was merged to the branch mainline in revision 5839.
  • Revision ID: andrew.bennetts@canonical.com-20110504023405-2o1o97b5d759db9b
Be a little more clever about constructing a parents provider for stacked repositories, so that get_parent_map with local-stacked-on-remote doesn't use HPSS VFS calls.

Show diffs side-by-side

added added

removed removed

Lines of Context:
179
179
            self.missing_keys.add(key)
180
180
 
181
181
 
 
182
class CallableToParentsProviderAdapter(object):
 
183
    """A parents provider that adapts any callable to the parents provider API.
 
184
 
 
185
    i.e. it accepts calls to self.get_parent_map and relays them to the
 
186
    callable it was constructed with.
 
187
    """
 
188
 
 
189
    def __init__(self, a_callable):
 
190
        self.callable = a_callable
 
191
 
 
192
    def __repr__(self):
 
193
        return "%s(%r)" % (self.__class__.__name__, self.callable)
 
194
 
 
195
    def get_parent_map(self, keys):
 
196
        return self.callable(keys)
 
197
 
 
198
 
182
199
class Graph(object):
183
200
    """Provide incremental access to revision graphs.
184
201