~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_merge_directive.py

Add KMail mail client

Show diffs side-by-side

added added

removed removed

Lines of Context:
109
109
booga""".splitlines(True)
110
110
 
111
111
 
 
112
INPUT1_2_OLD = """
 
113
I was thinking today about creating a merge directive.
 
114
 
 
115
So I did.
 
116
 
 
117
Here it is.
 
118
 
 
119
(I've pasted it in the body of this message)
 
120
 
 
121
Aaron
 
122
 
 
123
# Bazaar merge directive format 2 (Bazaar 0.19)\r
 
124
# revision_id: example:
 
125
# target_branch: http://example.com
 
126
# testament_sha1: sha
 
127
# timestamp: 1970-01-01 00:09:33 +0002
 
128
# source_branch: http://example.org
 
129
# base_revision_id: null:
 
130
# message: Hi mom!
 
131
#\x20
 
132
# Begin patch
 
133
booga""".splitlines(True)
 
134
 
 
135
 
 
136
OLD_DIRECTIVE_2 = """# Bazaar merge directive format 2 (Bazaar 0.19)
 
137
# revision_id: abentley@panoramicfeedback.com-20070807234458-\
 
138
#   nzhkoyza56lan7z5
 
139
# target_branch: http://panoramicfeedback.com/opensource/bzr/repo\
 
140
#   /bzr.ab
 
141
# testament_sha1: d825a5cdb267a90ec2ba86b00895f3d8a9bed6bf
 
142
# timestamp: 2007-08-10 16:15:02 -0400
 
143
# source_branch: http://panoramicfeedback.com/opensource/bzr/repo\
 
144
#   /bzr.ab
 
145
# base_revision_id: abentley@panoramicfeedback.com-20070731163346-\
 
146
#   623xwcycwij91xen
 
147
#
 
148
""".splitlines(True)
 
149
 
 
150
 
112
151
class TestMergeDirective(object):
113
152
 
114
153
    def test_merge_source(self):
599
638
        self.assertTrue(md2._verify_patch(tree_a.branch.repository))
600
639
        md2.patch = md2.patch.replace('content_c', 'content_d')
601
640
        self.assertFalse(md2._verify_patch(tree_a.branch.repository))
 
641
 
 
642
 
 
643
class TestParseOldMergeDirective2(tests.TestCase):
 
644
 
 
645
    def test_parse_old_merge_directive(self):
 
646
        md = merge_directive.MergeDirective.from_lines(INPUT1_2_OLD)
 
647
        self.assertEqual('example:', md.revision_id)
 
648
        self.assertEqual('sha', md.testament_sha1)
 
649
        self.assertEqual('http://example.com', md.target_branch)
 
650
        self.assertEqual('http://example.org', md.source_branch)
 
651
        self.assertEqual(453, md.time)
 
652
        self.assertEqual(120, md.timezone)
 
653
        self.assertEqual('booga', md.patch)
 
654
        self.assertEqual('diff', md.patch_type)
 
655
        self.assertEqual('Hi mom!', md.message)