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)
173
173
conflicts.DeletingParent('Not deleting', 'b', 'b-id'),
174
174
conflicts.UnversionedParent('Versioned directory', 'b', 'b-id')],
175
175
tree_a.conflicts())
177
def test_merge_with_missing(self):
178
tree_a = self.make_branch_and_tree('tree_a')
179
self.build_tree_contents([('tree_a/file', 'content_1')])
181
tree_a.commit('commit base')
182
base_tree = tree_a.basis_tree()
183
tree_b = tree_a.bzrdir.sprout('tree_b').open_workingtree()
184
self.build_tree_contents([('tree_a/file', 'content_2')])
185
tree_a.commit('commit other')
186
other_tree = tree_a.basis_tree()
187
os.unlink('tree_b/file')
188
merge_inner(tree_b.branch, other_tree, base_tree, this_tree=tree_b)
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'))
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',