/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

  • Committer: Martin Pool
  • Date: 2008-05-08 04:33:38 UTC
  • mfrom: (3414 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3415.
  • Revision ID: mbp@sourcefrog.net-20080508043338-ru3vflx8z641a76k
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
545
545
            plaintext = Testament(rev, inv).as_short_text()
546
546
            self.store_revision_signature(
547
547
                gpg.GPGStrategy(config), plaintext, revision_id)
548
 
        if not revision_id in self.get_inventory_weave():
 
548
        inventory_vf = self.get_inventory_weave()
 
549
        if not revision_id in inventory_vf:
549
550
            if inv is None:
550
551
                raise errors.WeaveRevisionNotPresent(revision_id,
551
 
                                                     self.get_inventory_weave())
 
552
                                                     inventory_vf)
552
553
            else:
553
554
                # yes, this is not suitable for adding with ghosts.
554
 
                rev.inventory_sha1 = self.add_inventory(revision_id, inv, 
 
555
                rev.inventory_sha1 = self.add_inventory(revision_id, inv,
555
556
                                                        rev.parent_ids)
 
557
        else:
 
558
            rev.inventory_sha1 = inventory_vf.get_sha1s([revision_id])[0]
556
559
        self._revision_store.add_revision(rev, self.get_transaction())
557
560
 
558
561
    def _add_revision_text(self, revision_id, text):
1109
1112
        rev_tmp.seek(0)
1110
1113
        return rev_tmp.getvalue()
1111
1114
 
1112
 
    @needs_read_lock
1113
1115
    def get_deltas_for_revisions(self, revisions):
1114
1116
        """Produce a generator of revision deltas.
1115
1117
        
1446
1448
        # maybe this generator should explicitly have the contract that it
1447
1449
        # should not be iterated until the previously yielded item has been
1448
1450
        # processed?
1449
 
        self.lock_read()
1450
1451
        inv_w = self.get_inventory_weave()
1451
1452
 
1452
1453
        # file ids that changed
1475
1476
                pass
1476
1477
            else:
1477
1478
                revisions_with_signatures.add(rev_id)
1478
 
        self.unlock()
1479
1479
        yield ("signatures", None, revisions_with_signatures)
1480
1480
 
1481
1481
        # revisions
1681
1681
            inv = self.get_revision_inventory(revision_id)
1682
1682
            return RevisionTree(self, inv, revision_id)
1683
1683
 
1684
 
    @needs_read_lock
1685
1684
    def revision_trees(self, revision_ids):
1686
1685
        """Return Tree for a revision on this branch.
1687
1686
 
1740
1739
    def get_transaction(self):
1741
1740
        return self.control_files.get_transaction()
1742
1741
 
 
1742
    @deprecated_method(symbol_versioning.one_five)
1743
1743
    def revision_parents(self, revision_id):
1744
1744
        return self.get_inventory_weave().parent_names(revision_id)
1745
1745
 
2383
2383
        :param revision_ids: The start point for the search.
2384
2384
        :return: A set of revision ids.
2385
2385
        """
2386
 
        graph = self.source.get_graph()
2387
2386
        target_graph = self.target.get_graph()
 
2387
        revision_ids = frozenset(revision_ids)
 
2388
        if set(target_graph.get_parent_map(revision_ids)) == revision_ids:
 
2389
            return graph.SearchResult(revision_ids, set(), 0, set())
2388
2390
        missing_revs = set()
 
2391
        source_graph = self.source.get_graph()
2389
2392
        # ensure we don't pay silly lookup costs.
2390
 
        revision_ids = frozenset(revision_ids)
2391
 
        searcher = graph._make_breadth_first_searcher(revision_ids)
 
2393
        searcher = source_graph._make_breadth_first_searcher(revision_ids)
2392
2394
        null_set = frozenset([_mod_revision.NULL_REVISION])
2393
2395
        while True:
2394
2396
            try:
2748
2750
            # inventory parsing etc, IFF nothing to be copied is in the target.
2749
2751
            # till then:
2750
2752
            revision_ids = self.source.all_revision_ids()
 
2753
            revision_keys = [(revid,) for revid in revision_ids]
 
2754
            index = self.target._pack_collection.revision_index.combined_index
 
2755
            present_revision_ids = set(item[1][0] for item in
 
2756
                index.iter_entries(revision_keys))
 
2757
            revision_ids = set(revision_ids) - present_revision_ids
2751
2758
            # implementing the TODO will involve:
2752
2759
            # - detecting when all of a pack is selected
2753
2760
            # - avoiding as much as possible pre-selection, so the
2764
2771
                    find_ghosts=find_ghosts).get_keys()
2765
2772
            except errors.NoSuchRevision:
2766
2773
                raise errors.InstallFailed([revision_id])
 
2774
            if len(revision_ids) == 0:
 
2775
                return (0, [])
2767
2776
        packs = self.source._pack_collection.all_packs()
2768
2777
        pack = Packer(self.target._pack_collection, packs, '.fetch',
2769
2778
            revision_ids).pack()