58
58
def test_no_tree(self):
59
59
# removing the active branch is possible if there is no tree
60
60
tree = self.example_tree('a')
61
tree.bzrdir.destroy_workingtree()
61
tree.controldir.destroy_workingtree()
62
62
self.run_bzr('rmbranch', working_dir='a')
63
63
dir = controldir.ControlDir.open('a')
64
64
self.assertFalse(dir.has_branch())
75
75
def test_remove_colo(self):
76
76
# Remove a colocated branch.
77
77
tree = self.example_tree('a')
78
tree.bzrdir.create_branch(name="otherbranch")
79
self.assertTrue(tree.bzrdir.has_branch('otherbranch'))
80
self.run_bzr('rmbranch %s,branch=otherbranch' % tree.bzrdir.user_url)
78
tree.controldir.create_branch(name="otherbranch")
79
self.assertTrue(tree.controldir.has_branch('otherbranch'))
80
self.run_bzr('rmbranch %s,branch=otherbranch' % tree.controldir.user_url)
81
81
dir = controldir.ControlDir.open('a')
82
82
self.assertFalse(dir.has_branch('otherbranch'))
83
83
self.assertTrue(dir.has_branch())
85
85
def test_remove_colo_directory(self):
86
86
# Remove a colocated branch.
87
87
tree = self.example_tree('a')
88
tree.bzrdir.create_branch(name="otherbranch")
89
self.assertTrue(tree.bzrdir.has_branch('otherbranch'))
90
self.run_bzr('rmbranch otherbranch -d %s' % tree.bzrdir.user_url)
88
tree.controldir.create_branch(name="otherbranch")
89
self.assertTrue(tree.controldir.has_branch('otherbranch'))
90
self.run_bzr('rmbranch otherbranch -d %s' % tree.controldir.user_url)
91
91
dir = controldir.ControlDir.open('a')
92
92
self.assertFalse(dir.has_branch('otherbranch'))
93
93
self.assertTrue(dir.has_branch())
95
95
def test_remove_active_colo_branch(self):
96
96
# Remove a colocated branch.
97
dir = self.make_repository('a').bzrdir
97
dir = self.make_repository('a').controldir
98
98
branch = dir.create_branch('otherbranch')
99
99
branch.create_checkout('a')
100
100
self.run_bzr_error(['Branch is active. Use --force to remove it.\n'],
101
'rmbranch otherbranch -d %s' % branch.bzrdir.user_url)
101
'rmbranch otherbranch -d %s' % branch.controldir.user_url)
102
102
self.assertTrue(dir.has_branch('otherbranch'))
103
self.run_bzr('rmbranch --force otherbranch -d %s' % branch.bzrdir.user_url)
103
self.run_bzr('rmbranch --force otherbranch -d %s' % branch.controldir.user_url)
104
104
self.assertFalse(dir.has_branch('otherbranch'))