25
25
class TestSharedRepo(TestCaseInTempDir):
27
27
def test_make_repository(self):
28
out, err = self.run_bzr("init-repository", "a")
28
out, err = self.run_bzr("init-repository a")
29
29
self.assertEqual(out, "")
30
30
self.assertEqual(err, "")
31
31
dir = BzrDir.open('a')
41
out, err = self.run_bzr("init-repository", ".")
41
out, err = self.run_bzr("init-repository .")
42
42
dir = BzrDir.open('.')
43
43
self.assertTrue(dir.open_repository())
45
45
def test_init(self):
46
self.run_bzr("init-repo", "a")
47
self.run_bzr("init", "--format=default", "a/b")
46
self.run_bzr("init-repo a")
47
self.run_bzr("init --format=default a/b")
48
48
dir = BzrDir.open('a')
49
49
self.assertIs(dir.open_repository().is_shared(), True)
50
50
self.assertRaises(errors.NotBranchError, dir.open_branch)
55
55
wt = bdir.open_workingtree()
57
57
def test_branch(self):
58
self.run_bzr("init-repo", "a")
59
self.run_bzr("init", "--format=default", "a/b")
60
self.run_bzr('branch', 'a/b', 'a/c')
58
self.run_bzr("init-repo a")
59
self.run_bzr("init --format=default a/b")
60
self.run_bzr('branch a/b a/c')
61
61
cdir = BzrDir.open('a/c')
63
63
self.assertRaises(errors.NoRepositoryPresent, cdir.open_repository)
64
64
cdir.open_workingtree()
66
66
def test_branch_tree(self):
67
self.run_bzr("init-repo", "--trees", "a")
68
self.run_bzr("init", "--format=default", "b")
67
self.run_bzr("init-repo --trees a")
68
self.run_bzr("init --format=default b")
69
69
file('b/hello', 'wt').write('bar')
70
self.run_bzr("add", "b/hello")
71
self.run_bzr("commit", "-m", "bar", "b/hello")
70
self.run_bzr("add b/hello")
71
self.run_bzr("commit -m bar b/hello")
73
self.run_bzr('branch', 'b', 'a/c')
73
self.run_bzr('branch b a/c')
74
74
cdir = BzrDir.open('a/c')
76
76
self.assertRaises(errors.NoRepositoryPresent, cdir.open_repository)
80
80
def test_trees_default(self):
81
81
# 0.15 switched to trees by default
82
self.run_bzr("init-repo", "repo")
82
self.run_bzr("init-repo repo")
83
83
repo = BzrDir.open("repo").open_repository()
84
84
self.assertEqual(True, repo.make_working_trees())
86
86
def test_trees_argument(self):
87
87
# Supplying the --trees argument should be harmless,
88
88
# as it was previously non-default we need to get it right.
89
self.run_bzr("init-repo", "--trees", "trees")
89
self.run_bzr("init-repo --trees trees")
90
90
repo = BzrDir.open("trees").open_repository()
91
91
self.assertEqual(True, repo.make_working_trees())
93
93
def test_no_trees_argument(self):
94
94
# --no-trees should make it so that there is no working tree
95
self.run_bzr("init-repo", "--no-trees", "notrees")
95
self.run_bzr("init-repo --no-trees notrees")
96
96
repo = BzrDir.open("notrees").open_repository()
97
97
self.assertEqual(False, repo.make_working_trees())