~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_commit.py

  • Committer: Martin Pool
  • Date: 2006-05-11 08:17:09 UTC
  • mto: This revision was merged to the branch mainline in revision 1707.
  • Revision ID: mbp@sourcefrog.net-20060511081709-2cf6b60a3d5a33fb
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:
186
186
        self.assertEqualDiff('', out)
187
187
        self.assertEqualDiff('bzr: ERROR: Cannot perform local-only commits '
188
188
                             'on unbound branches.\n', err)
 
189
 
 
190
    def test_commit_a_text_merge_in_a_checkout(self):
 
191
        # checkouts perform multiple actions in a transaction across bond
 
192
        # branches and their master, and have been observed to fail in the
 
193
        # past. This is a user story reported to fail in bug #43959 where 
 
194
        # a merge done in a checkout (using the update command) failed to
 
195
        # commit correctly.
 
196
        self.run_bzr('init', 'trunk')
 
197
 
 
198
        self.run_bzr('checkout', 'trunk', 'u1')
 
199
        self.build_tree_contents([('u1/hosts', 'initial contents')])
 
200
        self.run_bzr('add', 'u1/hosts')
 
201
        self.run_bzr('commit', '-m', 'add hosts', 'u1')
 
202
 
 
203
        self.run_bzr('checkout', 'trunk', 'u2')
 
204
        self.build_tree_contents([('u2/hosts', 'altered in u2')])
 
205
        self.run_bzr('commit', '-m', 'checkin from u2', 'u2')
 
206
 
 
207
        # make an offline commits
 
208
        self.build_tree_contents([('u1/hosts', 'first offline change in u1')])
 
209
        self.run_bzr('commit', '-m', 'checkin offline', '--local', 'u1')
 
210
 
 
211
        # now try to pull in online work from u2, and then commit our offline
 
212
        # work as a merge
 
213
        # retcode 1 as we expect a text conflict
 
214
        self.run_bzr('update', 'u1', retcode=1)
 
215
        self.run_bzr('resolved', 'u1/hosts')
 
216
        # add a text change here to represent resolving the merge conflicts in
 
217
        # favour of a new version of the file not identical to either the u1
 
218
        # version or the u2 version.
 
219
        self.build_tree_contents([('u1/hosts', 'merge resolution\n')])
 
220
        self.run_bzr('commit', '-m', 'checkin merge of the offline work from u1', 'u1')