~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_merge_directive.py

  • Committer: Aaron Bentley
  • Date: 2007-03-16 15:14:40 UTC
  • mto: This revision was merged to the branch mainline in revision 2389.
  • Revision ID: abentley@panoramicfeedback.com-20070316151440-kwqaumvxjcyiurv2
Change bundle reader and merge directive to both be 'mergeables'

Show diffs side-by-side

added added

removed removed

Lines of Context:
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)
 
294
 
 
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'))
 
304
 
 
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'))
 
314
 
 
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)