~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bzrdir.py

resolve conflicts against trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
    transport as _mod_transport,
39
39
    urlutils,
40
40
    win32utils,
41
 
    workingtree,
 
41
    workingtree_3,
 
42
    workingtree_4,
42
43
    )
43
44
import bzrlib.branch
44
45
from bzrlib.errors import (
65
66
from bzrlib.transport.http._urllib import HttpTransport_urllib
66
67
from bzrlib.transport.nosmart import NoSmartTransportDecorator
67
68
from bzrlib.transport.readonly import ReadonlyTransportDecorator
68
 
from bzrlib.repofmt import knitrepo, pack_repo
 
69
from bzrlib.repofmt import knitrepo, knitpack_repo
69
70
 
70
71
 
71
72
class TestDefaultFormat(TestCase):
73
74
    def test_get_set_default_format(self):
74
75
        old_format = bzrdir.BzrDirFormat.get_default_format()
75
76
        # default is BzrDirMetaFormat1
76
 
        self.failUnless(isinstance(old_format, bzrdir.BzrDirMetaFormat1))
 
77
        self.assertIsInstance(old_format, bzrdir.BzrDirMetaFormat1)
77
78
        controldir.ControlDirFormat._set_default_format(SampleBzrDirFormat())
78
79
        # creating a bzr dir should now create an instrumented dir.
79
80
        try:
80
81
            result = bzrdir.BzrDir.create('memory:///')
81
 
            self.failUnless(isinstance(result, SampleBzrDir))
 
82
            self.assertIsInstance(result, SampleBzrDir)
82
83
        finally:
83
84
            controldir.ControlDirFormat._set_default_format(old_format)
84
85
        self.assertEqual(old_format, bzrdir.BzrDirFormat.get_default_format())
286
287
            format.initialize(url)
287
288
            t = _mod_transport.get_transport(url)
288
289
            found_format = bzrdir.BzrDirFormat.find_format(t)
289
 
            self.failUnless(isinstance(found_format, format.__class__))
 
290
            self.assertIsInstance(found_format, format.__class__)
290
291
        check_format(BzrDirFormatTest1(), "foo")
291
292
        check_format(BzrDirFormatTest2(), "bar")
292
293
 
501
502
    def test_default_stacking_with_stackable_branch_unstackable_repo(self):
502
503
        # Make stackable source branch with an unstackable repo format.
503
504
        source_bzrdir = self.make_bzrdir('source')
504
 
        pack_repo.RepositoryFormatKnitPack1().initialize(source_bzrdir)
 
505
        knitpack_repo.RepositoryFormatKnitPack1().initialize(source_bzrdir)
505
506
        source_branch = bzrlib.branch.BzrBranchFormat7().initialize(
506
507
            source_bzrdir)
507
508
        # Make a directory with a default stacking policy
797
798
        tree2 = tree.bzrdir.sprout('tree2').open_workingtree()
798
799
        tree2.lock_read()
799
800
        self.addCleanup(tree2.unlock)
800
 
        self.failUnlessExists('tree2/subtree/file')
 
801
        self.assertPathExists('tree2/subtree/file')
801
802
        self.assertEqual('tree-reference', tree2.kind('subtree-root'))
802
803
 
803
804
    def test_cloning_metadir(self):
807
808
        branch = self.make_branch('branch', format='knit')
808
809
        format = branch.bzrdir.cloning_metadir()
809
810
        self.assertIsInstance(format.workingtree_format,
810
 
            workingtree.WorkingTreeFormat3)
 
811
            workingtree_4.WorkingTreeFormat6)
811
812
 
812
813
    def test_sprout_recursive_treeless(self):
813
814
        tree = self.make_branch_and_tree('tree1',
837
838
        # #634470.  -- vila 20100909
838
839
        self.assertRaises(errors.NotBranchError,
839
840
                          tree.bzrdir.sprout, 'repo/tree2')
840
 
#        self.failUnlessExists('repo/tree2/subtree')
841
 
#        self.failIfExists('repo/tree2/subtree/file')
 
841
#        self.assertPathExists('repo/tree2/subtree')
 
842
#        self.assertPathDoesNotExist('repo/tree2/subtree/file')
842
843
 
843
844
    def make_foo_bar_baz(self):
844
845
        foo = bzrdir.BzrDir.create_branch_convenience('foo').bzrdir
963
964
        checkout_base = t.clone('checkout').base
964
965
        self.assertEqual(checkout_base, dir.get_workingtree_transport(None).base)
965
966
        self.assertEqual(checkout_base,
966
 
                         dir.get_workingtree_transport(workingtree.WorkingTreeFormat3()).base)
 
967
                         dir.get_workingtree_transport(workingtree_3.WorkingTreeFormat3()).base)
967
968
 
968
969
    def test_meta1dir_uses_lockdir(self):
969
970
        """Meta1 format uses a LockDir to guard the whole directory, not a file."""
1057
1058
        my_bzrdir = bzrdir.BzrDir.open(self.get_url('branch-knit2'))
1058
1059
        checkout_format = my_bzrdir.checkout_metadir()
1059
1060
        self.assertIsInstance(checkout_format.workingtree_format,
1060
 
                              workingtree.WorkingTreeFormat3)
 
1061
                              workingtree_4.WorkingTreeFormat4)
1061
1062
 
1062
1063
 
1063
1064
class TestHTTPRedirections(object):