~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_merge_directive.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-07-19 16:09:34 UTC
  • mfrom: (2520.4.135 bzr.mpbundle)
  • Revision ID: pqm@pqm.ubuntu.com-20070719160934-d51fyijw69oto88p
Add new bundle and merge-directive formats

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
from bzrlib import (
21
21
    gpg,
 
22
    merge_directive,
22
23
    tests,
23
24
    workingtree,
24
25
    )
28
29
From: J. Random Hacker <jrandom@example.com>
29
30
Subject: bar
30
31
 
31
 
# Bazaar merge directive format 1
 
32
# Bazaar merge directive format 2 \\(Bazaar 0.18\\)
32
33
# revision_id: bar-id
33
34
# target_branch: ../tree2
34
35
# testament_sha1: .*
45
46
        self.tree1.branch.get_config().set_user_option('email',
46
47
            'J. Random Hacker <jrandom@example.com>')
47
48
        self.tree1.add('file')
48
 
        self.tree1.commit('foo')
 
49
        self.tree1.commit('foo', rev_id='foo-id')
49
50
        self.tree2 = self.tree1.bzrdir.sprout('tree2').open_workingtree()
50
51
        self.build_tree_contents([('tree1/file', 'a\nb\nc\nd\ne\n')])
51
52
        self.tree1.commit('bar', rev_id='bar-id')
58
59
        self.assertContainsRe(md_text, "\\+e")
59
60
        md_text = self.run_bzr('merge-directive -r -2 ../tree2')[0]
60
61
        self.assertNotContainsRe(md_text, "\\+e")
 
62
        md_text = self.run_bzr('merge-directive -r -1..-2 ../tree2')[0]
 
63
        md2 = merge_directive.MergeDirective.from_lines(
 
64
            md_text.splitlines(True))
 
65
        self.assertEqual('foo-id', md2.revision_id)
 
66
        self.assertEqual('bar-id', md2.base_revision_id)
61
67
 
62
68
    def test_submit_branch(self):
63
69
        self.prepare_merge_directive()
77
83
    def test_patch_types(self):
78
84
        self.prepare_merge_directive()
79
85
        md_text = self.run_bzr('merge-directive ../tree2')[0]
80
 
        self.assertContainsRe(md_text, "Bazaar revision bundle")
 
86
        self.assertContainsRe(md_text, "# Begin bundle")
81
87
        self.assertContainsRe(md_text, "\\+e")
82
88
        md_text = self.run_bzr('merge-directive ../tree2 --diff .')[0]
83
 
        self.assertNotContainsRe(md_text, "Bazaar revision bundle")
 
89
        self.assertNotContainsRe(md_text, "# Begin bundle")
84
90
        self.assertContainsRe(md_text, "\\+e")
85
91
        md_text = self.run_bzr('merge-directive --plain')[0]
86
92
        self.assertNotContainsRe(md_text, "\\+e")