60
_revision_v5_utc = """\
61
<revision committer="Martin Pool <mbp@sourcefrog.net>"
62
inventory_sha1="e79c31c1deb64c163cf660fdedd476dd579ffd41"
63
revision_id="mbp@sourcefrog.net-20050905080035-e0439293f8b6b9f9"
64
timestamp="1125907235.211783886"
66
<message>- start splitting code for xml (de)serialization away from objects
67
preparatory to supporting multiple formats by a single library
70
<revision_ref revision_id="mbp@sourcefrog.net-20050905063503-43948f59fa127d92"/>
60
75
_committed_inv_v5 = """<inventory>
61
76
<file file_id="bar-20050901064931-73b4b1138abc9cd2"
62
77
name="bar" parent_id="TREE_ROOT"
120
135
eq(rev.parent_ids[0],
121
136
"mbp@sourcefrog.net-20050905063503-43948f59fa127d92")
138
def test_unpack_revision_5_utc(self):
139
inp = StringIO(_revision_v5_utc)
140
rev = bzrlib.xml5.serializer_v5.read_revision(inp)
141
eq = self.assertEqual
143
"Martin Pool <mbp@sourcefrog.net>")
144
eq(len(rev.parent_ids), 1)
146
eq(rev.parent_ids[0],
147
"mbp@sourcefrog.net-20050905063503-43948f59fa127d92")
123
149
def test_unpack_inventory_5(self):
124
150
"""Unpack canned new-style inventory"""
125
151
inp = StringIO(_committed_inv_v5)
153
179
inv2 = bzrlib.xml5.serializer_v5.read_inventory(StringIO(outp.getvalue()))
154
180
self.assertEqual(inv, inv2)
182
def check_repack_revision(self, txt):
183
"""Check that repacking a revision yields the same information"""
185
rev = bzrlib.xml5.serializer_v5.read_revision(inp)
187
bzrlib.xml5.serializer_v5.write_revision(rev, outp)
188
outfile_contents = outp.getvalue()
189
rev2 = bzrlib.xml5.serializer_v5.read_revision(StringIO(outfile_contents))
190
self.assertEqual(rev, rev2)
156
192
def test_repack_revision_5(self):
157
193
"""Round-trip revision to XML v5"""
158
inp = StringIO(_revision_v5)
159
rev = bzrlib.xml5.serializer_v5.read_revision(inp)
161
bzrlib.xml5.serializer_v5.write_revision(rev, outp)
162
outfile_contents = outp.getvalue()
163
rev2 = bzrlib.xml5.serializer_v5.read_revision(StringIO(outfile_contents))
164
self.assertEqual(rev, rev2)
194
self.check_repack_revision(_revision_v5)
196
def test_repack_revision_5_utc(self):
197
self.check_repack_revision(_revision_v5_utc)
166
199
def test_pack_revision_5(self):
167
200
"""Pack revision to XML v5"""