31
31
patch='', patch_type='diff')
33
33
def test_serialization(self):
36
36
md = merge_directive.MergeDirective('example:', 'sha', time, timezone,
37
37
'http://example.com', source_branch="http://example.org",
38
38
patch='booga', patch_type='diff')
103
103
tree_a, tree_b, branch_c = self.make_trees()
104
104
self.assertRaises(errors.PublicBranchOutOfDate,
105
105
merge_directive.MergeDirective.from_objects,
106
tree_a.branch.repository, 'rev2a', 500, 120, tree_b.branch.base,
106
tree_a.branch.repository, 'rev2a', 500, 144, tree_b.branch.base,
107
107
public_branch=branch_c)
108
108
md1 = merge_directive.MergeDirective.from_objects(
109
tree_a.branch.repository, 'rev2a', 500.0, 120, tree_b.branch.base)
109
tree_a.branch.repository, 'rev2a', 500, 144, tree_b.branch.base)
110
110
self.assertContainsRe(md1.patch, 'Bazaar revision bundle')
111
111
self.assertContainsRe(md1.patch, '\\+content_c')
112
112
self.assertNotContainsRe(md1.patch, '\\+content_a')
113
113
branch_c.pull(tree_a.branch)
114
114
md2 = merge_directive.MergeDirective.from_objects(
115
tree_a.branch.repository, 'rev2a', 500.0, 120, tree_b.branch.base,
115
tree_a.branch.repository, 'rev2a', 500, 144, tree_b.branch.base,
116
116
patch_type='diff', public_branch=branch_c)
117
117
self.assertNotContainsRe(md2.patch, 'Bazaar revision bundle')
118
118
self.assertContainsRe(md1.patch, '\\+content_c')
119
119
self.assertNotContainsRe(md1.patch, '\\+content_a')
120
120
md3 = merge_directive.MergeDirective.from_objects(
121
tree_a.branch.repository, 'rev2a', 500.0, 120, tree_b.branch.base,
121
tree_a.branch.repository, 'rev2a', 500, 144, tree_b.branch.base,
122
122
patch_type=None, public_branch=branch_c, message='Merge message')
124
124
self.assertIs(None, md3.patch)
125
125
self.assertEqual('Merge message', md3.message)
127
127
def test_signing(self):
130
130
class FakeBranch(object):
131
131
def get_config(self):
148
148
def test_email(self):
149
149
tree_a, tree_b, branch_c = self.make_trees()
150
150
md = merge_directive.MergeDirective.from_objects(
151
tree_a.branch.repository, 'rev2a', 500.0, 120, tree_b.branch.base,
151
tree_a.branch.repository, 'rev2a', 500, 36, tree_b.branch.base,
152
152
patch_type=None, public_branch=tree_a.branch)
153
153
message = md.to_email('pqm@example.com', tree_a.branch)
154
154
self.assertContainsRe(message.as_string(), EMAIL1)