~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_shared_repository.py

  • Committer: Ross Lagerwall
  • Date: 2012-08-07 06:32:51 UTC
  • mto: (6437.63.5 2.5)
  • mto: This revision was merged to the branch mainline in revision 6558.
  • Revision ID: rosslagerwall@gmail.com-20120807063251-x9p03ghg2ws8oqjc
Add bzrlib/locale to .bzrignore

bzrlib/locale is generated with ./setup.py build_mo which is in turn called
by ./setup.py build

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
import os
20
20
 
21
 
from bzrlib.bzrdir import BzrDirMetaFormat1
22
 
from bzrlib.controldir import ControlDir
 
21
from bzrlib.bzrdir import BzrDir, BzrDirMetaFormat1
23
22
import bzrlib.errors as errors
24
23
from bzrlib.tests import TestCaseInTempDir
25
24
from bzrlib.tests.matchers import ContainsNoVfsCalls
35
34
  shared repository: a
36
35
""")
37
36
        self.assertEqual(err, "")
38
 
        dir = ControlDir.open('a')
 
37
        dir = BzrDir.open('a')
39
38
        self.assertIs(dir.open_repository().is_shared(), True)
40
39
        self.assertRaises(errors.NotBranchError, dir.open_branch)
41
40
        self.assertRaises(errors.NoWorkingTree, dir.open_workingtree)
44
43
        out, err = self.run_bzr("init-repository a -q")
45
44
        self.assertEqual(out, "")
46
45
        self.assertEqual(err, "")
47
 
        dir = ControlDir.open('a')
 
46
        dir = BzrDir.open('a')
48
47
        self.assertIs(dir.open_repository().is_shared(), True)
49
48
        self.assertRaises(errors.NotBranchError, dir.open_branch)
50
49
        self.assertRaises(errors.NoWorkingTree, dir.open_workingtree)
55
54
        (Malone #38331)
56
55
        """
57
56
        out, err = self.run_bzr("init-repository .")
58
 
        dir = ControlDir.open('.')
 
57
        dir = BzrDir.open('.')
59
58
        self.assertTrue(dir.open_repository())
60
59
 
61
60
    def test_init(self):
62
61
        self.run_bzr("init-repo a")
63
62
        self.run_bzr("init --format=default a/b")
64
 
        dir = ControlDir.open('a')
 
63
        dir = BzrDir.open('a')
65
64
        self.assertIs(dir.open_repository().is_shared(), True)
66
65
        self.assertRaises(errors.NotBranchError, dir.open_branch)
67
66
        self.assertRaises(errors.NoWorkingTree, dir.open_workingtree)
68
 
        bdir = ControlDir.open('a/b')
 
67
        bdir = BzrDir.open('a/b')
69
68
        bdir.open_branch()
70
69
        self.assertRaises(errors.NoRepositoryPresent, bdir.open_repository)
71
70
        wt = bdir.open_workingtree()
74
73
        self.run_bzr("init-repo a")
75
74
        self.run_bzr("init --format=default a/b")
76
75
        self.run_bzr('branch a/b a/c')
77
 
        cdir = ControlDir.open('a/c')
 
76
        cdir = BzrDir.open('a/c')
78
77
        cdir.open_branch()
79
78
        self.assertRaises(errors.NoRepositoryPresent, cdir.open_repository)
80
79
        cdir.open_workingtree()
87
86
        self.run_bzr("commit -m bar b/hello")
88
87
 
89
88
        self.run_bzr('branch b a/c')
90
 
        cdir = ControlDir.open('a/c')
 
89
        cdir = BzrDir.open('a/c')
91
90
        cdir.open_branch()
92
91
        self.assertRaises(errors.NoRepositoryPresent, cdir.open_repository)
93
92
        self.assertPathExists('a/c/hello')
96
95
    def test_trees_default(self):
97
96
        # 0.15 switched to trees by default
98
97
        self.run_bzr("init-repo repo")
99
 
        repo = ControlDir.open("repo").open_repository()
 
98
        repo = BzrDir.open("repo").open_repository()
100
99
        self.assertEqual(True, repo.make_working_trees())
101
100
 
102
101
    def test_trees_argument(self):
103
102
        # Supplying the --trees argument should be harmless,
104
103
        # as it was previously non-default we need to get it right.
105
104
        self.run_bzr("init-repo --trees trees")
106
 
        repo = ControlDir.open("trees").open_repository()
 
105
        repo = BzrDir.open("trees").open_repository()
107
106
        self.assertEqual(True, repo.make_working_trees())
108
107
 
109
108
    def test_no_trees_argument(self):
110
109
        # --no-trees should make it so that there is no working tree
111
110
        self.run_bzr("init-repo --no-trees notrees")
112
 
        repo = ControlDir.open("notrees").open_repository()
 
111
        repo = BzrDir.open("notrees").open_repository()
113
112
        self.assertEqual(False, repo.make_working_trees())
114
113
 
115
114
    def test_init_repo_smart_acceptance(self):
130
129
        out, err = self.run_bzr("init-repository -q a")
131
130
        self.assertEqual(out, "")
132
131
        self.assertEqual(err, "")
133
 
        dir = ControlDir.open('a')
 
132
        dir = BzrDir.open('a')
134
133
        dir.open_repository() # there is a repository there
135
134
        e = self.assertRaises(errors.NotBranchError, dir.open_branch)
136
135
        self.assertContainsRe(str(e), "location is a repository")
146
145
 
147
146
    def test_init_repo_with_post_repo_init_hook(self):
148
147
        calls = []
149
 
        ControlDir.hooks.install_named_hook('post_repo_init', calls.append, None)
 
148
        BzrDir.hooks.install_named_hook('post_repo_init', calls.append, None)
150
149
        self.assertLength(0, calls)
151
150
        self.run_bzr("init-repository a")
152
151
        self.assertLength(1, calls)