~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/bzrdir_implementations/test_bzrdir.py

Merge in InterRepository api to have it available.

Show diffs side-by-side

added added

removed removed

Lines of Context:
121
121
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport)
122
122
    
123
123
    def test_clone_bzrdir_repository(self):
 
124
        tree = self.make_branch_and_tree('commit_tree')
 
125
        self.build_tree(['foo'], transport=tree.bzrdir.transport.clone('..'))
 
126
        tree.add('foo')
 
127
        tree.commit('revision 1', rev_id='1')
124
128
        dir = self.make_bzrdir('source')
125
129
        repo = dir.create_repository()
126
 
        # add some content to differentiate from an empty repository.
127
 
        repo.control_weaves.add_text('inventory',
128
 
                                     "A",
129
 
                                     [],
130
 
                                     [],
131
 
                                     repo.get_transaction())
 
130
        repo.fetch(tree.branch.repository)
 
131
        self.assertTrue(repo.has_revision('1'))
132
132
        target = dir.clone(self.get_url('target'))
133
133
        self.assertNotEqual(dir.transport.base, target.transport.base)
134
134
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport)
135
135
 
136
136
    def test_clone_bzrdir_repository_under_shared(self):
 
137
        tree = self.make_branch_and_tree('commit_tree')
 
138
        self.build_tree(['foo'], transport=tree.bzrdir.transport.clone('..'))
 
139
        tree.add('foo')
 
140
        tree.commit('revision 1', rev_id='1')
137
141
        dir = self.make_bzrdir('source')
138
142
        repo = dir.create_repository()
139
 
        # add some content to differentiate from an empty repository.
140
 
        repo.control_weaves.add_text('inventory',
141
 
                                     "A",
142
 
                                     [],
143
 
                                     [],
144
 
                                     repo.get_transaction())
 
143
        repo.fetch(tree.branch.repository)
 
144
        self.assertTrue(repo.has_revision('1'))
145
145
        try:
146
146
            self.make_repository('target', shared=True)
147
147
        except errors.IncompatibleFormat:
171
171
        self.assertTrue(shared_repo.has_revision('1'))
172
172
        
173
173
    def test_clone_bzrdir_repository_under_shared_force_new_repo(self):
 
174
        tree = self.make_branch_and_tree('commit_tree')
 
175
        self.build_tree(['foo'], transport=tree.bzrdir.transport.clone('..'))
 
176
        tree.add('foo')
 
177
        tree.commit('revision 1', rev_id='1')
174
178
        dir = self.make_bzrdir('source')
175
179
        repo = dir.create_repository()
176
 
        # add some content to differentiate from an empty repository.
177
 
        repo.control_weaves.add_text('inventory',
178
 
                                     "A",
179
 
                                     [],
180
 
                                     [],
181
 
                                     repo.get_transaction())
 
180
        repo.fetch(tree.branch.repository)
 
181
        self.assertTrue(repo.has_revision('1'))
182
182
        try:
183
183
            self.make_repository('target', shared=True)
184
184
        except errors.IncompatibleFormat:
386
386
        target.open_workingtree()
387
387
    
388
388
    def test_sprout_bzrdir_repository(self):
 
389
        tree = self.make_branch_and_tree('commit_tree')
 
390
        self.build_tree(['foo'], transport=tree.bzrdir.transport.clone('..'))
 
391
        tree.add('foo')
 
392
        tree.commit('revision 1', rev_id='1')
389
393
        dir = self.make_bzrdir('source')
390
394
        repo = dir.create_repository()
391
 
        # add some content to differentiate from an empty repository.
392
 
        repo.control_weaves.add_text('inventory',
393
 
                                     "A",
394
 
                                     [],
395
 
                                     [],
396
 
                                     repo.get_transaction())
 
395
        repo.fetch(tree.branch.repository)
 
396
        self.assertTrue(repo.has_revision('1'))
397
397
        target = dir.sprout(self.get_url('target'))
398
398
        self.assertNotEqual(dir.transport.base, target.transport.base)
399
399
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport)