~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Aaron Bentley
  • Date: 2007-02-06 15:32:30 UTC
  • mto: This revision was merged to the branch mainline in revision 2268.
  • Revision ID: abentley@panoramicfeedback.com-20070206153230-39dpslyj1bkk781l
Ensure merge works across kind changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
from bzrlib.branch import Branch
25
25
from bzrlib.bzrdir import BzrDir
26
 
from bzrlib.conflicts import ConflictList
27
 
from bzrlib.osutils import abspath
 
26
from bzrlib.conflicts import ConflictList, ContentsConflict
 
27
from bzrlib.osutils import abspath, file_kind
28
28
from bzrlib.tests.blackbox import ExternalBase
29
29
import bzrlib.urlutils as urlutils
30
30
from bzrlib.workingtree import WorkingTree
269
269
        self.assertContainsRe(err, '1 revision\\(s\\) pulled')
270
270
        tree_a = WorkingTree.open('.')
271
271
        self.assertEqual([self.id2], tree_a.get_parent_ids())
 
272
 
 
273
    def test_merge_kind_change(self):
 
274
        tree_a = self.make_branch_and_tree('tree_a')
 
275
        self.build_tree_contents([('tree_a/file', 'content_1')])
 
276
        tree_a.add('file', 'file-id')
 
277
        tree_a.commit('added file')
 
278
        tree_b = tree_a.bzrdir.sprout('tree_b').open_workingtree()
 
279
        os.unlink('tree_a/file')
 
280
        self.build_tree(['tree_a/file/'])
 
281
        tree_a.commit('changed file to directory')
 
282
        os.chdir('tree_b')
 
283
        self.run_bzr('merge', '../tree_a')
 
284
        self.assertEqual('directory', file_kind('file'))
 
285
        tree_b.revert([])
 
286
        self.assertEqual('file', file_kind('file'))
 
287
        self.build_tree_contents([('file', 'content_2')])
 
288
        tree_b.commit('content change')
 
289
        self.run_bzr('merge', '../tree_a', retcode=1)
 
290
        self.assertEqual(tree_b.conflicts(),
 
291
                         [ContentsConflict('file', file_id='file-id')])