291
291
md.message = 'Commit of rev2a with special message'
292
292
message = md.to_email('pqm@example.com', tree_a.branch)
293
293
self.assertContainsRe(message.as_string(), EMAIL2)
295
def test_get_target_revision_branch(self):
296
tree_a, tree_b, branch_c = self.make_trees()
297
md = merge_directive.MergeDirective.from_objects(
298
tree_a.branch.repository, 'rev2a', 500, 36, tree_b.branch.base,
299
patch_type=None, public_branch=tree_a.branch.base)
300
self.assertFalse(tree_b.branch.repository.has_revision('rev2a'))
301
revision = md.get_target_revision(tree_b.branch.repository)
302
self.assertEqual('rev2a', revision)
303
self.assertTrue(tree_b.branch.repository.has_revision('rev2a'))
305
def test_get_target_revision_bundle(self):
306
tree_a, tree_b, branch_c = self.make_trees()
307
md = merge_directive.MergeDirective.from_objects(
308
tree_a.branch.repository, 'rev2a', 500, 36, tree_b.branch.base,
309
patch_type='bundle', public_branch=tree_a.branch.base)
310
self.assertFalse(tree_b.branch.repository.has_revision('rev2a'))
311
revision = md.get_target_revision(tree_b.branch.repository)
312
self.assertEqual('rev2a', revision)
313
self.assertTrue(tree_b.branch.repository.has_revision('rev2a'))
315
def test_get_target_revision_nofetch(self):
316
tree_a, tree_b, branch_c = self.make_trees()
317
tree_b.branch.fetch(tree_a.branch)
318
md = merge_directive.MergeDirective.from_objects(
319
tree_a.branch.repository, 'rev2a', 500, 36, tree_b.branch.base,
320
patch_type=None, public_branch=tree_a.branch.base)
321
md.source_branch = '/dev/null'
322
revision = md.get_target_revision(tree_b.branch.repository)
323
self.assertEqual('rev2a', revision)