equal
deleted
inserted
replaced
32 Current new format is a list of arbitrary record of the form: |
32 Current new format is a list of arbitrary record of the form: |
33 |
33 |
34 [type][length][content] |
34 [type][length][content] |
35 |
35 |
36 Type is a single character, length is a 4 bytes integer, content is an |
36 Type is a single character, length is a 4 bytes integer, content is an |
37 arbitrary suites of bytes of lenght `length`. |
37 arbitrary suites of bytes of length `length`. |
38 |
38 |
39 Type should be a letter. Capital letter are mandatory record, Mercurial |
39 Type should be a letter. Capital letter are mandatory record, Mercurial |
40 should abort if they are unknown. lower case record can be safely ignored. |
40 should abort if they are unknown. lower case record can be safely ignored. |
41 |
41 |
42 Currently known record: |
42 Currently known record: |
123 off = 0 |
123 off = 0 |
124 end = len(data) |
124 end = len(data) |
125 while off < end: |
125 while off < end: |
126 rtype = data[off] |
126 rtype = data[off] |
127 off += 1 |
127 off += 1 |
128 lenght = _unpack('>I', data[off:(off + 4)])[0] |
128 length = _unpack('>I', data[off:(off + 4)])[0] |
129 off += 4 |
129 off += 4 |
130 record = data[off:(off + lenght)] |
130 record = data[off:(off + length)] |
131 off += lenght |
131 off += length |
132 records.append((rtype, record)) |
132 records.append((rtype, record)) |
133 f.close() |
133 f.close() |
134 except IOError, err: |
134 except IOError, err: |
135 if err.errno != errno.ENOENT: |
135 if err.errno != errno.ENOENT: |
136 raise |
136 raise |