~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_workingtree.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-05-05 03:14:25 UTC
  • mfrom: (5816.5.7 workingtree-3)
  • Revision ID: pqm@pqm.ubuntu.com-20110505031425-f1pyxrpf6wu8jads
(jelmer) Split WorkingTree3 out into a separate file. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
    symbol_versioning,
23
23
    transport,
24
24
    workingtree,
 
25
    workingtree_3,
 
26
    workingtree_4,
25
27
    )
26
28
from bzrlib.lockdir import LockDir
27
29
from bzrlib.mutabletree import needs_tree_write_lock
62
64
 
63
65
    def test_get_set_default_format(self):
64
66
        old_format = workingtree.format_registry.get_default()
65
 
        # default is 3
66
 
        self.assertTrue(isinstance(old_format, workingtree.WorkingTreeFormat3))
 
67
        # default is 6
 
68
        self.assertTrue(isinstance(old_format, workingtree_4.WorkingTreeFormat6))
67
69
        workingtree.format_registry.set_default(SampleTreeFormat())
68
70
        try:
69
71
            # the default branch format is used by the meta dir format
79
81
 
80
82
    def test_get_set_default_format_by_key(self):
81
83
        old_format = workingtree.format_registry.get_default()
82
 
        # default is 3
 
84
        # default is 6
83
85
        format = SampleTreeFormat()
84
86
        workingtree.format_registry.register(format)
85
87
        self.addCleanup(workingtree.format_registry.remove, format)
86
 
        self.assertTrue(isinstance(old_format, workingtree.WorkingTreeFormat3))
 
88
        self.assertTrue(isinstance(old_format, workingtree_4.WorkingTreeFormat6))
87
89
        workingtree.format_registry.set_default_key(format.get_format_string())
88
90
        try:
89
91
            # the default branch format is used by the meta dir format
191
193
            t = transport.get_transport(url)
192
194
            found_format = workingtree.WorkingTreeFormat.find_format(dir)
193
195
            self.assertIsInstance(found_format, format.__class__)
194
 
        check_format(workingtree.WorkingTreeFormat3(), "bar")
 
196
        check_format(workingtree_3.WorkingTreeFormat3(), "bar")
195
197
 
196
198
    def test_find_format_no_tree(self):
197
199
        dir = bzrdir.BzrDirMetaFormat1().initialize('.')
275
277
        control = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
276
278
        control.create_repository()
277
279
        control.create_branch()
278
 
        tree = workingtree.WorkingTreeFormat3().initialize(control)
 
280
        tree = workingtree_3.WorkingTreeFormat3().initialize(control)
279
281
        # we want:
280
282
        # format 'Bazaar-NG Working Tree format 3'
281
283
        # inventory = blank inventory
309
311
        repo = dir.create_repository()
310
312
        branch = dir.create_branch()
311
313
        try:
312
 
            tree = workingtree.WorkingTreeFormat3().initialize(dir)
 
314
            tree = workingtree_3.WorkingTreeFormat3().initialize(dir)
313
315
        except errors.NotLocalUrl:
314
316
            raise TestSkipped('Not a local URL')
315
317
        self.assertIsDirectory('.bzr', t)
326
328
        control = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
327
329
        control.create_repository()
328
330
        control.create_branch()
329
 
        tree = workingtree.WorkingTreeFormat3().initialize(control)
 
331
        tree = workingtree_3.WorkingTreeFormat3().initialize(control)
330
332
        tree._transport.delete("pending-merges")
331
333
        self.assertEqual([], tree.get_parent_ids())
332
334