~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

Merge bzr.dev, resolving conflicts and updating test_merge_directive.py.

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
    )
29
30
To: pqm@example.com
30
31
User-Agent: Bazaar \(.*\)
31
32
 
32
 
# Bazaar merge directive format 1
 
33
# Bazaar merge directive format 2 \\(Bazaar 0.18\\)
33
34
# revision_id: bar-id
34
35
# target_branch: ../tree2
35
36
# testament_sha1: .*
46
47
        self.tree1.branch.get_config().set_user_option('email',
47
48
            'J. Random Hacker <jrandom@example.com>')
48
49
        self.tree1.add('file')
49
 
        self.tree1.commit('foo')
 
50
        self.tree1.commit('foo', rev_id='foo-id')
50
51
        self.tree2 = self.tree1.bzrdir.sprout('tree2').open_workingtree()
51
52
        self.build_tree_contents([('tree1/file', 'a\nb\nc\nd\ne\n')])
52
53
        self.tree1.commit('bar', rev_id='bar-id')
59
60
        self.assertContainsRe(md_text, "\\+e")
60
61
        md_text = self.run_bzr('merge-directive -r -2 ../tree2')[0]
61
62
        self.assertNotContainsRe(md_text, "\\+e")
 
63
        md_text = self.run_bzr('merge-directive -r -1..-2 ../tree2')[0]
 
64
        md2 = merge_directive.MergeDirective.from_lines(
 
65
            md_text.splitlines(True))
 
66
        self.assertEqual('foo-id', md2.revision_id)
 
67
        self.assertEqual('bar-id', md2.base_revision_id)
62
68
 
63
69
    def test_submit_branch(self):
64
70
        self.prepare_merge_directive()
78
84
    def test_patch_types(self):
79
85
        self.prepare_merge_directive()
80
86
        md_text = self.run_bzr('merge-directive ../tree2')[0]
81
 
        self.assertContainsRe(md_text, "Bazaar revision bundle")
 
87
        self.assertContainsRe(md_text, "# Begin bundle")
82
88
        self.assertContainsRe(md_text, "\\+e")
83
89
        md_text = self.run_bzr('merge-directive ../tree2 --diff .')[0]
84
 
        self.assertNotContainsRe(md_text, "Bazaar revision bundle")
 
90
        self.assertNotContainsRe(md_text, "# Begin bundle")
85
91
        self.assertContainsRe(md_text, "\\+e")
86
92
        md_text = self.run_bzr('merge-directive --plain')[0]
87
93
        self.assertNotContainsRe(md_text, "\\+e")