/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: Alexander Belchenko
  • Date: 2008-02-06 10:07:17 UTC
  • mfrom: (3211 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3230.
  • Revision ID: bialix@ukr.net-20080206100717-wnixj1s8u2fks08r
merge bzr.dev

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