/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/versionedfile.py

  • Committer: Robert Collins
  • Date: 2007-08-07 22:59:45 UTC
  • mfrom: (2681 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2682.
  • Revision ID: robertc@robertcollins.net-20070807225945-dlxppeb3we4lh897
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
390
390
        :param version_ids: Versions to select.
391
391
                            None means retrieve all versions.
392
392
        """
 
393
        if version_ids is None:
 
394
            return dict(self.iter_parents(self.versions()))
393
395
        result = {}
394
 
        if version_ids is None:
395
 
            for version in self.versions():
396
 
                result[version] = self.get_parents(version)
397
 
        else:
398
 
            pending = set(osutils.safe_revision_id(v) for v in version_ids)
399
 
            while pending:
400
 
                version = pending.pop()
401
 
                if version in result:
402
 
                    continue
403
 
                parents = self.get_parents(version)
 
396
        pending = set(osutils.safe_revision_id(v) for v in version_ids)
 
397
        while pending:
 
398
            this_iteration = pending
 
399
            pending = set()
 
400
            for version, parents in self.iter_parents(this_iteration):
 
401
                result[version] = parents
404
402
                for parent in parents:
405
403
                    if parent in result:
406
404
                        continue
407
405
                    pending.add(parent)
408
 
                result[version] = parents
409
406
        return result
410
407
 
411
408
    def get_graph_with_ghosts(self):
501
498
        """
502
499
        raise NotImplementedError(self.iter_lines_added_or_present_in_versions)
503
500
 
 
501
    def iter_parents(self, version_ids):
 
502
        """Iterate through the parents for many version ids.
 
503
 
 
504
        :param version_ids: An iterable yielding version_ids.
 
505
        :return: An iterator that yields (version_id, parents). Requested 
 
506
            version_ids not present in the versioned file are simply skipped.
 
507
            The order is undefined, allowing for different optimisations in
 
508
            the underlying implementation.
 
509
        """
 
510
        for version_id in version_ids:
 
511
            try:
 
512
                yield version_id, tuple(self.get_parents(version_id))
 
513
            except errors.RevisionNotPresent:
 
514
                pass
 
515
 
504
516
    def transaction_finished(self):
505
517
        """The transaction that this file was opened in has finished.
506
518