~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-11 16:16:00 UTC
  • mto: (2323.6.9 0.15-integration)
  • mto: This revision was merged to the branch mainline in revision 2342.
  • Revision ID: aaron.bentley@utoronto.ca-20070311161600-hvtsmkf3d2z72562
Allow leading junk before merge directive header

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
booga"""
44
44
 
45
45
 
 
46
INPUT1 = """
 
47
I was thinking today about creating a merge directive.
 
48
 
 
49
So I did.
 
50
 
 
51
Here it is.
 
52
 
 
53
(I've pasted it in the body of this message)
 
54
 
 
55
Aaron
 
56
 
 
57
# Bazaar merge directive format 1\r
 
58
# revision_id: example:
 
59
# target_branch: http://example.com
 
60
# testament_sha1: sha
 
61
# timestamp: 1970-01-01 00:09:33 +0002
 
62
# source_branch: http://example.org
 
63
# message: Hi mom!
 
64
#\x20
 
65
booga""".splitlines(True)
 
66
 
 
67
 
46
68
class TestMergeDirective(tests.TestCase):
47
69
 
48
70
    def test_merge_source(self):
89
111
        self.assertRaises(errors.NotAMergeDirective,
90
112
                          merge_directive.MergeDirective.from_lines, 'lala')
91
113
 
 
114
    def test_deserialize_leading_junk(self):
 
115
        md = merge_directive.MergeDirective.from_lines(INPUT1)
 
116
        self.assertEqual('example:', md.revision_id)
 
117
        self.assertEqual('sha', md.testament_sha1)
 
118
        self.assertEqual('http://example.com', md.target_branch)
 
119
        self.assertEqual('http://example.org', md.source_branch)
 
120
        self.assertEqual(501, md.time)
 
121
        self.assertEqual(72, md.timezone)
 
122
        self.assertEqual('booga', md.patch)
 
123
        self.assertEqual('diff', md.patch_type)
 
124
        self.assertEqual('Hi mom!', md.message)
92
125
 
93
126
    def test_roundtrip(self):
94
127
        time = 501