/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 bzrlib/tests/blackbox/test_branch.py

Merge with stacked-fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2008 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
43
43
        self.example_branch('a')
44
44
        self.run_bzr('branch a b')
45
45
        b = branch.Branch.open('b')
46
 
        self.assertEqual('b\n', b.control_files.get_utf8('branch-name').read())
47
46
        self.run_bzr('branch a c -r 1')
 
47
        # previously was erroneously created by branching
 
48
        self.assertFalse(b._transport.has('branch-name'))
48
49
        b.bzrdir.open_workingtree().commit(message='foo', allow_pointless=True)
49
50
 
50
51
    def test_branch_only_copies_history(self):
97
98
        self.assertEqual(source_stat, target_stat)
98
99
 
99
100
    def assertShallow(self, branch_revid, stacked_on):
100
 
        """Assert that the branch 'published' has been published correctly."""
 
101
        """Assert that the branch 'newbranch' has been published correctly."""
101
102
        new_branch = branch.Branch.open('newbranch')
102
103
        # The branch refers to the mainline
103
104
        self.assertEqual(stacked_on, new_branch.get_stacked_on())
104
105
        # and the branch's work was pushed
105
106
        self.assertTrue(new_branch.repository.has_revision(branch_revid))
106
 
        # but the mainlines was not included
 
107
        # but the mainline's was not included
107
108
        repo = new_branch.bzrdir.open_repository()
108
109
        self.assertEqual(1, len(repo.all_revision_ids()))
109
110
 
110
 
    def test_branch_shallow_branch_also_shallow_same_reference(self):
 
111
    def test_branch_stacked_branch_also_stacked_same_reference(self):
111
112
        # We have a mainline
112
113
        trunk_tree = self.make_branch_and_tree('target',
113
114
            format='development')
114
115
        trunk_tree.commit('mainline')
115
 
        # and a branch from it which is shallow
 
116
        # and a branch from it which is stacked
116
117
        branch_tree = self.make_branch_and_tree('branch',
117
118
            format='development')
118
119
        branch_tree.branch.set_stacked_on(trunk_tree.branch.base)
122
123
        # mainline.
123
124
        out, err = self.run_bzr(['branch', 'branch', 'newbranch'])
124
125
        self.assertEqual('', out)
125
 
        self.assertEqual('Created new shallow branch referring to %s.\n' %
 
126
        self.assertEqual('Created new stacked branch referring to %s.\n' %
126
127
            trunk_tree.branch.base, err)
127
128
        self.assertShallow(branch_tree.last_revision(),
128
129
            trunk_tree.branch.base)
129
130
 
130
 
    def test_branch_shallow(self):
 
131
    def test_branch_stacked(self):
131
132
        # We have a mainline
132
133
        trunk_tree = self.make_branch_and_tree('mainline',
133
134
            format='development')
134
135
        trunk_tree.commit('mainline')
135
 
        # and make branch from it which is shallow
136
 
        out, err = self.run_bzr(['branch', '--shallow', 'mainline', 'newbranch'])
 
136
        # and a branch from it which is stacked
 
137
        out, err = self.run_bzr(['branch', '--stacked', 'mainline',
 
138
            'newbranch'])
137
139
        self.assertEqual('', out)
138
 
        self.assertEqual('Created new shallow branch referring to %s.\n' %
 
140
        self.assertEqual('Created new stacked branch referring to %s.\n' %
139
141
            trunk_tree.branch.base, err)
140
142
        new_tree = WorkingTree.open('newbranch')
141
143
        new_revid = new_tree.commit('new work')