28
28
class TestSharedRepo(TestCaseInTempDir):
30
30
def test_make_repository(self):
31
out, err = self.run_bzr("init-repository a")
31
out, err = self.run_bzr("init-shared-repository a")
32
32
self.assertEqual(out,
33
33
"""Shared repository with trees (format: 2a)
41
41
self.assertRaises(errors.NoWorkingTree, dir.open_workingtree)
43
43
def test_make_repository_quiet(self):
44
out, err = self.run_bzr("init-repository a -q")
44
out, err = self.run_bzr("init-shared-repository a -q")
45
45
self.assertEqual(out, "")
46
46
self.assertEqual(err, "")
47
47
dir = ControlDir.open('a')
57
out, err = self.run_bzr("init-repository .")
57
out, err = self.run_bzr("init-shared-repository .")
58
58
dir = ControlDir.open('.')
59
59
self.assertTrue(dir.open_repository())
61
61
def test_init(self):
62
self.run_bzr("init-repo a")
62
self.run_bzr("init-shared-repo a")
63
63
self.run_bzr("init --format=default a/b")
64
64
dir = ControlDir.open('a')
65
65
self.assertIs(dir.open_repository().is_shared(), True)
71
71
wt = bdir.open_workingtree()
73
73
def test_branch(self):
74
self.run_bzr("init-repo a")
74
self.run_bzr("init-shared-repo a")
75
75
self.run_bzr("init --format=default a/b")
76
76
self.run_bzr('branch a/b a/c')
77
77
cdir = ControlDir.open('a/c')
80
80
cdir.open_workingtree()
82
82
def test_branch_tree(self):
83
self.run_bzr("init-repo --trees a")
83
self.run_bzr("init-shared-repo --trees a")
84
84
self.run_bzr("init --format=default b")
85
85
with open('b/hello', 'wt') as f:
97
97
def test_trees_default(self):
98
98
# 0.15 switched to trees by default
99
self.run_bzr("init-repo repo")
99
self.run_bzr("init-shared-repo repo")
100
100
repo = ControlDir.open("repo").open_repository()
101
101
self.assertEqual(True, repo.make_working_trees())
103
103
def test_trees_argument(self):
104
104
# Supplying the --trees argument should be harmless,
105
105
# as it was previously non-default we need to get it right.
106
self.run_bzr("init-repo --trees trees")
106
self.run_bzr("init-shared-repo --trees trees")
107
107
repo = ControlDir.open("trees").open_repository()
108
108
self.assertEqual(True, repo.make_working_trees())
110
110
def test_no_trees_argument(self):
111
111
# --no-trees should make it so that there is no working tree
112
self.run_bzr("init-repo --no-trees notrees")
112
self.run_bzr("init-shared-repo --no-trees notrees")
113
113
repo = ControlDir.open("notrees").open_repository()
114
114
self.assertEqual(False, repo.make_working_trees())
116
116
def test_init_repo_smart_acceptance(self):
117
# The amount of hpss calls made on init-repo to a smart server should
117
# The amount of hpss calls made on init-shared-repo to a smart server
119
119
self.setup_smart_server_with_call_log()
120
self.run_bzr(['init-repo', self.get_url('repo')])
120
self.run_bzr(['init-shared-repo', self.get_url('repo')])
121
121
# This figure represent the amount of work to perform this use case. It
122
122
# is entirely ok to reduce this number if a test fails due to rpc_count
123
123
# being too low. If rpc_count increases, more network roundtrips have
128
128
self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
130
130
def test_notification_on_branch_from_repository(self):
131
out, err = self.run_bzr("init-repository -q a")
131
out, err = self.run_bzr("init-shared-repository -q a")
132
132
self.assertEqual(out, "")
133
133
self.assertEqual(err, "")
134
134
dir = ControlDir.open('a')
150
150
ControlDir.hooks.install_named_hook(
151
151
'post_repo_init', calls.append, None)
152
152
self.assertLength(0, calls)
153
self.run_bzr("init-repository a")
153
self.run_bzr("init-shared-repository a")
154
154
self.assertLength(1, calls)
156
156
def test_init_repo_without_username(self):
157
"""Ensure init-repo works if username is not set.
157
"""Ensure init-shared-repo works if username is not set.
159
159
# brz makes user specified whoami mandatory for operations
160
# like commit as whoami is recorded. init-repo however is not so final
161
# and uses whoami only in a lock file. Without whoami the login name
162
# is used. This test is to ensure that init-repo passes even when whoami
160
# like commit as whoami is recorded. init-shared-repo however is not so
161
# final and uses whoami only in a lock file. Without whoami the login name
162
# is used. This test is to ensure that init-shared-repo passes even
163
# when whoami is not available.
164
164
self.overrideEnv('EMAIL', None)
165
165
self.overrideEnv('BRZ_EMAIL', None)
166
out, err = self.run_bzr(['init-repo', 'foo'])
166
out, err = self.run_bzr(['init-shared-repo', 'foo'])
167
167
self.assertEqual(err, '')
168
168
self.assertTrue(os.path.exists('foo'))