/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/blackbox/test_rmbranch.py

  • Committer: Jelmer Vernooij
  • Date: 2020-05-06 02:13:25 UTC
  • mfrom: (7490.7.21 work)
  • mto: This revision was merged to the branch mainline in revision 7501.
  • Revision ID: jelmer@jelmer.uk-20200506021325-awbmmqu1zyorz7sj
Merge 3.1 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 
31
31
    def example_tree(self, path='.', format=None):
32
32
        tree = self.make_branch_and_tree(path, format=format)
33
 
        self.build_tree_contents([(path + '/hello', 'foo')])
 
33
        self.build_tree_contents([(path + '/hello', b'foo')])
34
34
        tree.add('hello')
35
35
        tree.commit(message='setup')
36
 
        self.build_tree_contents([(path + '/goodbye', 'baz')])
 
36
        self.build_tree_contents([(path + '/goodbye', b'baz')])
37
37
        tree.add('goodbye')
38
38
        tree.commit(message='setup')
39
39
        return tree
42
42
        # Remove a local branch.
43
43
        tree = self.example_tree('a')
44
44
        self.run_bzr_error(['Branch is active. Use --force to remove it.\n'],
45
 
            'rmbranch a')
 
45
                           'rmbranch a')
46
46
        self.run_bzr('rmbranch --force a')
47
47
        dir = controldir.ControlDir.open('a')
48
48
        self.assertFalse(dir.has_branch())
52
52
    def test_no_branch(self):
53
53
        # No branch in the current directory.
54
54
        self.make_repository('a')
55
 
        self.run_bzr_error(['Not a branch'],
56
 
            'rmbranch a')
 
55
        self.run_bzr_error(['Not a branch'], 'rmbranch a')
57
56
 
58
57
    def test_no_tree(self):
59
58
        # removing the active branch is possible if there is no tree
67
66
        # location argument defaults to current directory
68
67
        self.example_tree('a')
69
68
        self.run_bzr_error(['Branch is active. Use --force to remove it.\n'],
70
 
            'rmbranch a')
 
69
                           'rmbranch a')
71
70
        self.run_bzr('rmbranch --force', working_dir='a')
72
71
        dir = controldir.ControlDir.open('a')
73
72
        self.assertFalse(dir.has_branch())
77
76
        tree = self.example_tree('a')
78
77
        tree.controldir.create_branch(name="otherbranch")
79
78
        self.assertTrue(tree.controldir.has_branch('otherbranch'))
80
 
        self.run_bzr('rmbranch %s,branch=otherbranch' % tree.controldir.user_url)
 
79
        self.run_bzr('rmbranch %s,branch=otherbranch' %
 
80
                     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())
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.controldir.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.controldir.user_url)
 
103
        self.run_bzr('rmbranch --force otherbranch -d %s' %
 
104
                     branch.controldir.user_url)
104
105
        self.assertFalse(dir.has_branch('otherbranch'))
105
106
 
106
107