289
290
self.run_bzr('merge ../tree_a', retcode=1)
290
291
self.assertEqual(tree_b.conflicts(),
291
292
[ContentsConflict('file', file_id='file-id')])
294
def test_directive_cherrypick(self):
295
source = self.make_branch_and_tree('source')
296
self.build_tree(['source/a'])
298
source.commit('Added a', rev_id='rev1')
299
self.build_tree(['source/b'])
301
source.commit('Added b', rev_id='rev2')
302
target = self.make_branch_and_tree('target')
303
target.commit('empty commit')
304
self.write_directive('directive', source.branch, 'target', 'rev2',
306
self.run_bzr('merge -d target directive')
307
self.failIfExists('target/a')
308
self.failUnlessExists('target/b')
310
def write_directive(self, filename, source, target, revision_id,
311
base_revision_id=None, mangle_patch=False):
312
md = merge_directive.MergeDirective2.from_objects(
313
source.repository, revision_id, 0, 0, target,
314
base_revision_id=base_revision_id)
317
self.build_tree_contents([(filename, ''.join(md.to_lines()))])
319
def test_directive_verify_warning(self):
320
source = self.make_branch_and_tree('source')
321
self.build_tree(['source/a'])
323
source.commit('Added a', rev_id='rev1')
324
target = self.make_branch_and_tree('target')
325
target.commit('empty commit')
326
self.write_directive('directive', source.branch, 'target', 'rev1')
327
err = self.run_bzr('merge -d target directive')[1]
328
self.assertNotContainsRe(err, 'Preview patch does not match changes')
330
self.write_directive('directive', source.branch, 'target', 'rev1',
332
err = self.run_bzr('merge -d target directive')[1]
333
self.assertContainsRe(err, 'Preview patch does not match changes')