~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/graph.py

  • Committer: John Arbash Meinel
  • Date: 2008-02-25 22:41:36 UTC
  • mto: This revision was merged to the branch mainline in revision 3281.
  • Revision ID: john@arbash-meinel.com-20080225224136-g5dpjx3nzxcwbvvm
Change iter_ancestry to take a group instead of a single node,

Show diffs side-by-side

added added

removed removed

Lines of Context:
424
424
                raise errors.NoCommonAncestor(left_revision, right_revision)
425
425
            revisions = lca
426
426
 
427
 
    def iter_ancestry(self, revision_id):
 
427
    def iter_ancestry(self, revision_ids):
428
428
        """Iterate the ancestry of this revision.
429
429
 
430
430
        The specific order is undefined, but children should be returned before
431
431
        parents.
432
432
 
 
433
        :param revision_ids: Nodes to start the search
433
434
        :return: Yield tuples mapping a revision_id to its parents for the
434
435
            ancestry of revision_id.
 
436
            Ghosts will be returned with parents of the empty tuple, and nodes
 
437
            with no parents will have NULL_REVISION as their only parent. (As
 
438
            defined by get_parent_map.)
 
439
            There also be a node for (NULL_REVISION, ())
435
440
        """
436
441
        # XXX: Do we want to guarantee that children will be returned before
437
442
        #      parents? At present that is the order, but I don't know that it
438
443
        #      is beneficial to require it.
439
 
        pending = set([revision_id])
 
444
        pending = set(revision_ids)
440
445
        processed = set()
441
446
        while pending:
442
447
            processed.update(pending)