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

Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
592
592
        Returns a set of the present revisions.
593
593
        """
594
594
        result = []
595
 
        for id in revision_ids:
596
 
            if self.has_revision(id):
597
 
               result.append(id)
598
 
        return result
 
595
        graph = self.get_graph()
 
596
        parent_map = graph.get_parent_map(revision_ids)
 
597
        # The old API returned a list, should this actually be a set?
 
598
        return parent_map.keys()
599
599
 
600
600
    @staticmethod
601
601
    def create(a_bzrdir):
1110
1110
        rev_tmp.seek(0)
1111
1111
        return rev_tmp.getvalue()
1112
1112
 
1113
 
    @needs_read_lock
1114
1113
    def get_deltas_for_revisions(self, revisions):
1115
1114
        """Produce a generator of revision deltas.
1116
1115
        
1447
1446
        # maybe this generator should explicitly have the contract that it
1448
1447
        # should not be iterated until the previously yielded item has been
1449
1448
        # processed?
1450
 
        self.lock_read()
1451
1449
        inv_w = self.get_inventory_weave()
1452
1450
 
1453
1451
        # file ids that changed
1476
1474
                pass
1477
1475
            else:
1478
1476
                revisions_with_signatures.add(rev_id)
1479
 
        self.unlock()
1480
1477
        yield ("signatures", None, revisions_with_signatures)
1481
1478
 
1482
1479
        # revisions
1682
1679
            inv = self.get_revision_inventory(revision_id)
1683
1680
            return RevisionTree(self, inv, revision_id)
1684
1681
 
1685
 
    @needs_read_lock
1686
1682
    def revision_trees(self, revision_ids):
1687
1683
        """Return Tree for a revision on this branch.
1688
1684
 
2385
2381
        :return: A set of revision ids.
2386
2382
        """
2387
2383
        graph = self.source.get_graph()
 
2384
        target_graph = self.target.get_graph()
2388
2385
        missing_revs = set()
2389
2386
        # ensure we don't pay silly lookup costs.
2390
2387
        revision_ids = frozenset(revision_ids)
2399
2396
                absent_ids = set(revision_ids.intersection(ghosts))
2400
2397
                # If all absent_ids are present in target, no error is needed.
2401
2398
                absent_ids.difference_update(
2402
 
                    self.target.has_revisions(absent_ids))
 
2399
                    set(target_graph.get_parent_map(absent_ids)))
2403
2400
                if absent_ids:
2404
2401
                    raise errors.NoSuchRevision(self.source, absent_ids.pop())
2405
2402
            # we don't care about other ghosts as we can't fetch them and
2406
2403
            # haven't been asked to.
2407
2404
            next_revs = set(next_revs)
2408
2405
            # we always have NULL_REVISION present.
2409
 
            have_revs = self.target.has_revisions(next_revs).union(null_set)
 
2406
            have_revs = set(target_graph.get_parent_map(next_revs)).union(null_set)
2410
2407
            missing_revs.update(next_revs - have_revs)
2411
2408
            searcher.stop_searching_any(have_revs)
2412
2409
        return searcher.get_result()
2558
2555
        # weave specific optimised path:
2559
2556
        try:
2560
2557
            self.target.set_make_working_trees(self.source.make_working_trees())
2561
 
        except NotImplementedError:
 
2558
        except (errors.RepositoryUpgradeRequired, NotImplemented):
2562
2559
            pass
2563
2560
        # FIXME do not peek!
2564
2561
        if self.source.control_files._transport.listable():
2745
2742
            # inventory parsing etc, IFF nothing to be copied is in the target.
2746
2743
            # till then:
2747
2744
            revision_ids = self.source.all_revision_ids()
 
2745
            revision_keys = [(revid,) for revid in revision_ids]
 
2746
            index = self.target._pack_collection.revision_index.combined_index
 
2747
            present_revision_ids = set(item[1][0] for item in
 
2748
                index.iter_entries(revision_keys))
 
2749
            revision_ids = set(revision_ids) - present_revision_ids
2748
2750
            # implementing the TODO will involve:
2749
2751
            # - detecting when all of a pack is selected
2750
2752
            # - avoiding as much as possible pre-selection, so the