/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_commit.py

[patch] use the correct transaction when committing snapshot (Malone: #43959)

Without this, file merges committed in a checkout can't be properly 
pushed into the master repository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
165
165
        self.assertEqualDiff('', out)
166
166
        self.assertEqualDiff('bzr: ERROR: Cannot perform local-only commits '
167
167
                             'on unbound branches.\n', err)
 
168
 
 
169
    def test_commit_a_text_merge_in_a_checkout(self):
 
170
        # checkouts perform multiple actions in a transaction across bond
 
171
        # branches and their master, and have been observed to fail in the
 
172
        # past. This is a user story reported to fail in bug #43959 where 
 
173
        # a merge done in a checkout (using the update command) failed to
 
174
        # commit correctly.
 
175
        self.run_bzr('init', 'trunk')
 
176
 
 
177
        self.run_bzr('checkout', 'trunk', 'u1')
 
178
        self.build_tree_contents([('u1/hosts', 'initial contents')])
 
179
        self.run_bzr('add', 'u1/hosts')
 
180
        self.run_bzr('commit', '-m', 'add hosts', 'u1')
 
181
 
 
182
        self.run_bzr('checkout', 'trunk', 'u2')
 
183
        self.build_tree_contents([('u2/hosts', 'altered in u2')])
 
184
        self.run_bzr('commit', '-m', 'checkin from u2', 'u2')
 
185
 
 
186
        # make an offline commits
 
187
        self.build_tree_contents([('u1/hosts', 'first offline change in u1')])
 
188
        self.run_bzr('commit', '-m', 'checkin offline', '--local', 'u1')
 
189
 
 
190
        # now try to pull in online work from u2, and then commit our offline
 
191
        # work as a merge
 
192
        # retcode 1 as we expect a text conflict
 
193
        self.run_bzr('update', 'u1', retcode=1)
 
194
        self.run_bzr('resolved', 'u1/hosts')
 
195
        # add a text change here to represent resolving the merge conflicts in
 
196
        # favour of a new version of the file not identical to either the u1
 
197
        # version or the u2 version.
 
198
        self.build_tree_contents([('u1/hosts', 'merge resolution\n')])
 
199
        self.run_bzr('commit', '-m', 'checkin merge of the offline work from u1', 'u1')