/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/graph.py

  • Committer: Ian Clatworthy
  • Date: 2008-01-29 06:56:51 UTC
  • mfrom: (3184.5.2 insert_data_stream)
  • mto: This revision was merged to the branch mainline in revision 3205.
  • Revision ID: ian.clatworthy@internode.on.net-20080129065651-a333d6eqoxt5bu69
Fix error handling in insert_data_stream (Lukas Lalinsky)

Show diffs side-by-side

added added

removed removed

Lines of Context:
473
473
            return set(heads)
474
474
 
475
475
 
476
 
class HeadsCache(object):
477
 
    """A cache of results for graph heads calls."""
478
 
 
479
 
    def __init__(self, graph):
480
 
        self.graph = graph
481
 
        self._heads = {}
482
 
 
483
 
    def heads(self, keys):
484
 
        """Return the heads of keys.
485
 
 
486
 
        :see also: Graph.heads.
487
 
        :param keys: The keys to calculate heads for.
488
 
        :return: A set containing the heads, which may be mutated without
489
 
            affecting future lookups.
490
 
        """
491
 
        keys = frozenset(keys)
492
 
        try:
493
 
            return set(self._heads[keys])
494
 
        except KeyError:
495
 
            heads = self.graph.heads(keys)
496
 
            self._heads[keys] = heads
497
 
            return set(heads)
498
 
 
499
 
 
500
476
class _BreadthFirstSearcher(object):
501
477
    """Parallel search breadth-first the ancestry of revisions.
502
478