~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_merge.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-02-06 20:54:42 UTC
  • mfrom: (1959.4.6 typechange)
  • Revision ID: pqm@pqm.ubuntu.com-20070206205442-4a0752247e60cabf
Commit supports kind changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
from bzrlib.conflicts import ConflictList, TextConflict
24
24
from bzrlib.errors import UnrelatedBranches, NoCommits, BzrCommandError
25
25
from bzrlib.merge import transform_tree, merge_inner
26
 
from bzrlib.osutils import pathjoin
 
26
from bzrlib.osutils import pathjoin, file_kind
27
27
from bzrlib.revision import common_ancestor
28
28
from bzrlib.tests import TestCaseWithTransport
29
29
from bzrlib.trace import (enable_test_log, disable_test_log)
186
186
        other_tree = tree_a.basis_tree()
187
187
        os.unlink('tree_b/file')
188
188
        merge_inner(tree_b.branch, other_tree, base_tree, this_tree=tree_b)
 
189
 
 
190
    def test_merge_kind_change(self):
 
191
        tree_a = self.make_branch_and_tree('tree_a')
 
192
        self.build_tree_contents([('tree_a/file', 'content_1')])
 
193
        tree_a.add('file', 'file-id')
 
194
        tree_a.commit('added file')
 
195
        tree_b = tree_a.bzrdir.sprout('tree_b').open_workingtree()
 
196
        os.unlink('tree_a/file')
 
197
        self.build_tree(['tree_a/file/'])
 
198
        tree_a.commit('changed file to directory')
 
199
        tree_b.merge_from_branch(tree_a.branch)
 
200
        self.assertEqual('directory', file_kind('tree_b/file'))
 
201
        tree_b.revert([])
 
202
        self.assertEqual('file', file_kind('tree_b/file'))
 
203
        self.build_tree_contents([('tree_b/file', 'content_2')])
 
204
        tree_b.commit('content change')
 
205
        tree_b.merge_from_branch(tree_a.branch)
 
206
        self.assertEqual(tree_b.conflicts(),
 
207
                         [conflicts.ContentsConflict('file',
 
208
                          file_id='file-id')])