~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/graph.py

  • Committer: Jelmer Vernooij
  • Date: 2009-03-12 14:02:53 UTC
  • mfrom: (4135 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4137.
  • Revision ID: jelmer@samba.org-20090312140253-bmldbzlmsitfdrzf
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1415
1415
                    stop_parents.add(rev_id)
1416
1416
            self._next_query.difference_update(stop_parents)
1417
1417
        self._stopped_keys.update(stopped)
1418
 
        self._stopped_keys.update(revisions - set([revision.NULL_REVISION]))
 
1418
        self._stopped_keys.update(revisions)
1419
1419
        return stopped
1420
1420
 
1421
1421
    def start_searching(self, revisions):
1495
1495
        return self._keys
1496
1496
 
1497
1497
 
 
1498
class PendingAncestryResult(object):
 
1499
    """A search result that will reconstruct the ancestry for some graph heads.
 
1500
 
 
1501
    Unlike SearchResult, this doesn't hold the complete search result in
 
1502
    memory, it just holds a description of how to generate it.
 
1503
    """
 
1504
 
 
1505
    def __init__(self, heads, repo):
 
1506
        """Constructor.
 
1507
 
 
1508
        :param heads: an iterable of graph heads.
 
1509
        :param repo: a repository to use to generate the ancestry for the given
 
1510
            heads.
 
1511
        """
 
1512
        self.heads = heads
 
1513
        self.repo = repo
 
1514
 
 
1515
    def get_recipe(self):
 
1516
        raise NotImplementedError(self.get_recipe)
 
1517
 
 
1518
    def get_keys(self):
 
1519
        """See SearchResult.get_keys.
 
1520
 
 
1521
        Returns all the keys for the ancestry of the heads, excluding
 
1522
        NULL_REVISION.
 
1523
        """
 
1524
        return self._get_keys(self.repo.get_graph())
 
1525
 
 
1526
    def _get_keys(self, graph):
 
1527
        NULL_REVISION = revision.NULL_REVISION
 
1528
        keys = [key for (key, parents) in graph.iter_ancestry(self.heads)
 
1529
                if key != NULL_REVISION]
 
1530
        return keys
 
1531
 
 
1532
 
1498
1533
def collapse_linear_regions(parent_map):
1499
1534
    """Collapse regions of the graph that are 'linear'.
1500
1535