/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/tests/test_branch.py

  • Committer: Robert Collins
  • Date: 2007-04-23 02:29:35 UTC
  • mfrom: (2441 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2442.
  • Revision ID: robertc@robertcollins.net-20070423022935-9hhongamvk6bfdso
Resolve conflicts with bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
175
175
        BranchFormat.unregister_format(format)
176
176
        self.make_branch_and_tree('bar')
177
177
 
178
 
    def test_checkout_format(self):
179
 
        branch = self.make_repository('repository', shared=True)
180
 
        branch = self.make_branch('repository/branch',
181
 
            format='metaweave')
182
 
        tree = branch.create_checkout('checkout')
183
 
        self.assertIs(tree.branch.__class__, _mod_branch.BzrBranch5)
184
 
 
185
178
 
186
179
class TestBranch6(TestCaseWithTransport):
187
180
 
190
183
        format.set_branch_format(_mod_branch.BzrBranchFormat6())
191
184
        branch = self.make_branch('a', format=format)
192
185
        self.assertIsInstance(branch, _mod_branch.BzrBranch6)
193
 
        branch = self.make_branch('b', format='dirstate-with-subtree')
 
186
        branch = self.make_branch('b', format='dirstate-tags')
194
187
        self.assertIsInstance(branch, _mod_branch.BzrBranch6)
195
188
        branch = _mod_branch.Branch.open('a')
196
189
        self.assertIsInstance(branch, _mod_branch.BzrBranch6)
197
190
 
198
191
    def test_layout(self):
199
 
        branch = self.make_branch('a', format='dirstate-with-subtree')
 
192
        branch = self.make_branch('a', format='dirstate-tags')
200
193
        self.failUnlessExists('a/.bzr/branch/last-revision')
201
194
        self.failIfExists('a/.bzr/branch/revision-history')
202
195
 
203
196
    def test_config(self):
204
197
        """Ensure that all configuration data is stored in the branch"""
205
 
        branch = self.make_branch('a', format='dirstate-with-subtree')
 
198
        branch = self.make_branch('a', format='dirstate-tags')
206
199
        branch.set_parent('http://bazaar-vcs.org')
207
200
        self.failIfExists('a/.bzr/branch/parent')
208
201
        self.assertEqual('http://bazaar-vcs.org', branch.get_parent())
216
209
 
217
210
    def test_set_revision_history(self):
218
211
        tree = self.make_branch_and_memory_tree('.',
219
 
            format='dirstate-with-subtree')
 
212
            format='dirstate-tags')
220
213
        tree.lock_write()
221
214
        try:
222
215
            tree.add('.')
231
224
 
232
225
    def test_append_revision(self):
233
226
        tree = self.make_branch_and_tree('branch1',
234
 
            format='dirstate-with-subtree')
 
227
            format='dirstate-tags')
235
228
        tree.lock_write()
236
229
        try:
237
230
            tree.commit('foo', rev_id='foo')
305
298
        opened_branch = branch_dir.open_branch()
306
299
        self.assertEqual(opened_branch.base, target_branch.base)
307
300
 
 
301
    def test_get_reference(self):
 
302
        """For a BranchReference, get_reference should reutrn the location."""
 
303
        branch = self.make_branch('target')
 
304
        checkout = branch.create_checkout('checkout', lightweight=True)
 
305
        reference_url = branch.bzrdir.root_transport.abspath('') + '/'
 
306
        # if the api for create_checkout changes to return different checkout types
 
307
        # then this file read will fail.
 
308
        self.assertFileEqual(reference_url, 'checkout/.bzr/branch/location')
 
309
        self.assertEqual(reference_url,
 
310
            _mod_branch.BranchReferenceFormat().get_reference(checkout.bzrdir))
 
311
 
308
312
 
309
313
class TestHooks(TestCase):
310
314
 
320
324
    def test_installed_hooks_are_BranchHooks(self):
321
325
        """The installed hooks object should be a BranchHooks."""
322
326
        # the installed hooks are saved in self._preserved_hooks.
323
 
        self.assertIsInstance(self._preserved_hooks, BranchHooks)
 
327
        self.assertIsInstance(self._preserved_hooks[_mod_branch.Branch], BranchHooks)
324
328
 
325
329
    def test_install_hook_raises_unknown_hook(self):
326
330
        """install_hook should raise UnknownHook if a hook is unknown."""