/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: Robert Collins
  • Date: 2007-11-21 23:36:32 UTC
  • mto: This revision was merged to the branch mainline in revision 3014.
  • Revision ID: robertc@robertcollins.net-20071121233632-63hxiuhd5kcweg21
Test that missing_revision_ids handles the case of the source not having the requested revision correctly with and without find_ghosts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
792
792
                (format, data_list, StringIO(knit_bytes).read))
793
793
 
794
794
    @needs_read_lock
795
 
    def missing_revision_ids(self, other, revision_id=None):
 
795
    def missing_revision_ids(self, other, revision_id=None, find_ghosts=True):
796
796
        """Return the revision ids that other has that this does not.
797
797
        
798
798
        These are returned in topological order.
799
799
 
800
800
        revision_id: only return revision ids included by revision_id.
801
801
        """
802
 
        return InterRepository.get(other, self).missing_revision_ids(revision_id)
 
802
        return InterRepository.get(other, self).missing_revision_ids(
 
803
            revision_id, find_ghosts)
803
804
 
804
805
    @staticmethod
805
806
    def open(base):
2032
2033
        raise NotImplementedError(self.fetch)
2033
2034
   
2034
2035
    @needs_read_lock
2035
 
    def missing_revision_ids(self, revision_id=None):
 
2036
    def missing_revision_ids(self, revision_id=None, find_ghosts=True):
2036
2037
        """Return the revision ids that source has that target does not.
2037
2038
        
2038
2039
        These are returned in topological order.
2199
2200
        return f.count_copied, f.failed_revisions
2200
2201
 
2201
2202
    @needs_read_lock
2202
 
    def missing_revision_ids(self, revision_id=None):
 
2203
    def missing_revision_ids(self, revision_id=None, find_ghosts=True):
2203
2204
        """See InterRepository.missing_revision_ids()."""
2204
2205
        # we want all revisions to satisfy revision_id in source.
2205
2206
        # but we don't want to stat every file here and there.
2277
2278
        return f.count_copied, f.failed_revisions
2278
2279
 
2279
2280
    @needs_read_lock
2280
 
    def missing_revision_ids(self, revision_id=None):
 
2281
    def missing_revision_ids(self, revision_id=None, find_ghosts=True):
2281
2282
        """See InterRepository.missing_revision_ids()."""
2282
2283
        if revision_id is not None:
2283
2284
            source_ids = self.source.get_ancestry(revision_id)
2354
2355
            # sensibly detect 'new revisions' without doing a full index scan.
2355
2356
        elif _mod_revision.is_null(revision_id):
2356
2357
            # nothing to do:
2357
 
            return
 
2358
            return (0, [])
2358
2359
        else:
2359
2360
            try:
2360
2361
                revision_ids = self.missing_revision_ids(revision_id,
2370
2371
            # a pack creation, but for now it is simpler to think about as
2371
2372
            # 'upload data, then repack if needed'.
2372
2373
            self.target._pack_collection.autopack()
2373
 
            return pack.get_revision_count()
 
2374
            return (pack.get_revision_count(), [])
2374
2375
        else:
2375
 
            return 0
 
2376
            return (0, [])
2376
2377
 
2377
2378
    @needs_read_lock
2378
2379
    def missing_revision_ids(self, revision_id=None, find_ghosts=True):
2399
2400
                    target_index.iter_entries(target_keys))
2400
2401
                missing_revs.update(next_revs - have_revs)
2401
2402
                searcher.stop_searching_any(have_revs)
 
2403
            if next_revs - have_revs == set([revision_id]):
 
2404
                # we saw the start rev itself, but no parents from it (or
 
2405
                # next_revs would have been updated to e.g. set(). We remove
 
2406
                # have_revs because if we found revision_id locally we
 
2407
                # stop_searching at the first time around.
 
2408
                raise errors.NoSuchRevision(self.source, revision_id)
2402
2409
            return missing_revs
2403
2410
        elif revision_id is not None:
2404
2411
            source_ids = self.source.get_ancestry(revision_id)