51
51
self.build_tree(['tree/file'])
53
53
self.run_bzr_error(['Working tree ".*" has uncommitted changes'],
54
'reconfigure --branch tree')
54
'reconfigure --branch tree')
55
55
self.run_bzr('reconfigure --force --branch tree')
57
57
def test_lightweight_checkout_to_checkout(self):
81
81
self.run_bzr('reconfigure --use-shared', working_dir='repo/tree')
82
82
tree = workingtree.WorkingTree.open('repo/tree')
83
83
self.assertNotEqual(tree.controldir.root_transport.base,
84
tree.branch.repository.controldir.root_transport.base)
84
tree.branch.repository.controldir.root_transport.base)
86
86
def test_use_shared_to_standalone(self):
87
87
repo = self.make_repository('repo', shared=True)
88
88
branch = controldir.ControlDir.create_branch_convenience('repo/tree')
89
89
self.assertNotEqual(branch.controldir.root_transport.base,
90
branch.repository.controldir.root_transport.base)
90
branch.repository.controldir.root_transport.base)
91
91
self.run_bzr('reconfigure --standalone', working_dir='repo/tree')
92
92
tree = workingtree.WorkingTree.open('repo/tree')
93
93
self.assertEqual(tree.controldir.root_transport.base,
94
tree.branch.repository.controldir.root_transport.base)
94
tree.branch.repository.controldir.root_transport.base)
96
96
def test_make_with_trees(self):
97
97
repo = self.make_repository('repo', shared=True)
103
103
repo = self.make_repository('repo', shared=True)
104
104
repo.set_make_working_trees(True)
105
105
self.run_bzr_error([" already creates working trees"],
106
'reconfigure --with-trees repo')
106
'reconfigure --with-trees repo')
108
108
def test_make_without_trees(self):
109
109
repo = self.make_repository('repo', shared=True)
115
115
repo = self.make_repository('repo', shared=True)
116
116
repo.set_make_working_trees(False)
117
117
self.run_bzr_error([" already doesn't create working trees"],
118
'reconfigure --with-no-trees repo')
118
'reconfigure --with-no-trees repo')
120
120
def test_make_with_trees_nonshared_repo(self):
121
121
branch = self.make_branch('branch')
130
130
self.build_tree(['repo/branch/foo'])
132
132
self.run_bzr('reconfigure --with-no-trees --force',
133
working_dir='repo/branch')
133
working_dir='repo/branch')
134
134
self.assertPathExists('repo/branch/foo')
135
135
tree = workingtree.WorkingTree.open('repo/branch')
138
138
repo = self.make_repository('repo', shared=True, format=format)
139
139
branch = controldir.ControlDir.create_branch_convenience('repo/tree')
140
140
self.assertNotEqual(branch.controldir.root_transport.base,
141
branch.repository.controldir.root_transport.base)
141
branch.repository.controldir.root_transport.base)
142
142
tree = workingtree.WorkingTree.open('repo/tree')
143
self.build_tree_contents([('repo/tree/file', b'foo\n')])
143
self.build_tree_contents([('repo/tree/file', b'foo\n')]);
144
144
tree.add(['file'])
145
145
tree.commit('added file')
146
146
self.run_bzr('reconfigure --standalone', working_dir='repo/tree')
147
147
tree = workingtree.WorkingTree.open('repo/tree')
148
self.build_tree_contents([('repo/tree/file', b'bar\n')])
148
self.build_tree_contents([('repo/tree/file', b'bar\n')]);
149
149
self.check_file_contents('repo/tree/file', b'bar\n')
150
150
self.run_bzr('revert', working_dir='repo/tree')
151
self.check_file_contents('repo/tree/file', b'foo\n')
151
self.check_file_contents('repo/tree/file', 'foo\n')
152
152
self.assertEqual(tree.controldir.root_transport.base,
153
tree.branch.repository.controldir.root_transport.base)
153
tree.branch.repository.controldir.root_transport.base)
155
155
def test_shared_knit_to_standalone(self):
156
156
self.test_shared_format_to_standalone('knit')
165
165
branch = self.make_branch('branch', format=format)
166
166
checkout = branch.create_checkout('checkout', lightweight=True)
167
167
tree = workingtree.WorkingTree.open('checkout')
168
self.build_tree_contents([('checkout/file', b'foo\n')])
168
self.build_tree_contents([('checkout/file', b'foo\n')]);
169
169
tree.add(['file'])
170
170
tree.commit('added file')
171
171
self.run_bzr('reconfigure --tree', working_dir='checkout')
172
172
tree = workingtree.WorkingTree.open('checkout')
173
self.build_tree_contents([('checkout/file', b'bar\n')])
173
self.build_tree_contents([('checkout/file', b'bar\n')]);
174
174
self.check_file_contents('checkout/file', b'bar\n')
175
175
self.run_bzr('revert', working_dir='checkout')
176
self.check_file_contents('checkout/file', b'foo\n')
176
self.check_file_contents('checkout/file', 'foo\n')
178
178
def test_lightweight_knit_checkout_to_tree(self):
179
179
self.test_lightweight_format_checkout_to_tree('knit')
243
243
out, err = self.run_bzr('reconfigure --stacked-on b1 b2')
244
244
self.assertContainsRe(out, '^.*/b2/ is now stacked on ../b1\n$')
245
245
self.assertEqual('', err)
246
# can also give the absolute URL of the branch, and it gets stored
246
# can also give the absolute URL of the branch, and it gets stored
247
247
# as a relative path if possible
248
248
out, err = self.run_bzr('reconfigure --stacked-on %s b2'
249
249
% (self.get_url('b1'),))
260
260
# Now turn it off again
261
261
out, err = self.run_bzr('reconfigure --unstacked b2')
262
262
self.assertContainsRe(out,
263
'^.*/b2/ is now not stacked\n$')
263
'^.*/b2/ is now not stacked\n$')
264
264
self.assertEqual('', err)
265
265
# Refresh the branch as 'reconfigure' modified it
266
266
branch_2 = branch_2.controldir.open_branch()