/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 breezy/tests/per_interrepository/test_fetch.py

  • Committer: Jelmer Vernooij
  • Date: 2018-11-16 19:47:19 UTC
  • mfrom: (7178 work)
  • mto: This revision was merged to the branch mainline in revision 7179.
  • Revision ID: jelmer@jelmer.uk-20181116194719-m5ut2wfuze5x9s1p
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
    )
48
48
 
49
49
 
50
 
 
51
50
class TestInterRepository(TestCaseWithInterRepository):
52
51
 
53
52
    def disable_commit_write_group_paranoia(self, repo):
62
61
        self.build_tree(['a/foo'])
63
62
        tree_a.add('foo')
64
63
        rev1 = tree_a.commit('rev1')
 
64
 
65
65
        def check_push_rev1(repo):
66
66
            # ensure the revision is missing.
67
67
            self.assertRaises(NoSuchRevision, repo.get_revision, rev1)
116
116
            # 'FOO' changed in 'OLD'. OLD will not have that file at all.
117
117
            source.texts.insert_record_stream([
118
118
                versionedfile.FulltextContentFactory((b'foo', revid), (), None,
119
 
                b'contents')])
 
119
                                                     b'contents')])
120
120
            basis = source.revision_tree(revid)
121
121
            parent_id = basis.path2id('')
122
122
            entry = inventory.make_entry('file', 'foo-path', parent_id, b'foo')
142
142
        to_repo.lock_read()
143
143
        self.addCleanup(to_repo.unlock)
144
144
        self.assertEqual(b'contents',
145
 
            next(to_repo.texts.get_record_stream([(b'foo', revid)],
146
 
            'unordered', True)).get_bytes_as('fulltext'))
 
145
                         next(to_repo.texts.get_record_stream([(b'foo', revid)],
 
146
                                                              'unordered', True)).get_bytes_as('fulltext'))
147
147
 
148
148
    def test_fetch_from_stacked_smart(self):
149
149
        self.setup_smart_server_with_call_log()
270
270
        self.assertTrue(unstacked_repo.has_revision(merge))
271
271
        expected_texts = {(file_id, merge)}
272
272
        if stacked_branch.repository.texts.get_parent_map([(root_id,
273
 
            merge)]):
 
273
                                                            merge)]):
274
274
            # If a (root-id,merge) text exists, it should be in the stacked
275
275
            # repo.
276
276
            expected_texts.add((root_id, merge))
335
335
        self.assertTrue(unstacked_repo.has_revision(third))
336
336
        expected_texts = {(file_id, third)}
337
337
        if stacked_branch.repository.texts.get_parent_map([(root_id,
338
 
            third)]):
 
338
                                                            third)]):
339
339
            # If a (root-id,third) text exists, it should be in the stacked
340
340
            # repo.
341
341
            expected_texts.add((root_id, third))
424
424
        self.assertTrue(new_unstacked_repo.has_revision(b'merge'))
425
425
        expected_texts = {(b'file-id', b'merge')}
426
426
        if new_stacked_branch.repository.texts.get_parent_map([(b'root-id',
427
 
            b'merge')]):
 
427
                                                                b'merge')]):
428
428
            # If a (root-id,merge) text exists, it should be in the stacked
429
429
            # repo.
430
430
            expected_texts.add((b'root-id', b'merge'))
485
485
        repo_a = self.make_repository('.')
486
486
        repo_b = repository.Repository.open('.')
487
487
        self.assertRaises(errors.NoSuchRevision,
488
 
            repo_b.fetch, repo_a, revision_id=b'XXX')
 
488
                          repo_b.fetch, repo_a, revision_id=b'XXX')
489
489
 
490
490
    def test_fetch_same_location_trivial_works(self):
491
491
        repo_a = self.make_repository('.')
539
539
            check_repo_format_for_funky_id_on_win32(from_repo)
540
540
        self.build_tree(['tree/filename'])
541
541
        if not from_tree.supports_setting_file_ids():
542
 
            raise TestNotApplicable('from tree format can not create custom file ids')
 
542
            raise TestNotApplicable(
 
543
                'from tree format can not create custom file ids')
543
544
        from_tree.add('filename', b'funky-chars<>%&;"\'')
544
545
        from_tree.commit('commit filename')
545
546
        to_repo = self.make_to_repository('to')
546
547
        try:
547
 
            to_repo.fetch(from_tree.branch.repository, from_tree.get_parent_ids()[0])
 
548
            to_repo.fetch(from_tree.branch.repository,
 
549
                          from_tree.get_parent_ids()[0])
548
550
        except errors.NoRoundtrippingSupport:
549
551
            raise TestNotApplicable('roundtripping not supported')
550
552
 
576
578
        to_repo = self.make_to_repository('to')
577
579
        if (not from_tree.supports_tree_reference() or
578
580
            not from_tree.branch.repository._format.supports_tree_reference or
579
 
            not to_repo._format.supports_tree_reference):
 
581
                not to_repo._format.supports_tree_reference):
580
582
            raise TestNotApplicable("Need subtree support.")
581
583
        if not to_repo._format.supports_full_versioned_files:
582
584
            raise TestNotApplicable('Need full versioned files support.')
592
594
        # revid tree_rev.
593
595
        file_id = from_tree.path2id('subtree')
594
596
        with to_repo.lock_read():
595
 
            self.assertEqual({(file_id, tree_rev):()},
596
 
                to_repo.texts.get_parent_map([(file_id, tree_rev)]))
 
597
            self.assertEqual({(file_id, tree_rev): ()},
 
598
                             to_repo.texts.get_parent_map([(file_id, tree_rev)]))