Show More
@@ -200,6 +200,23 b' def _fm0readmarkers(data, off=0):' | |||
|
200 | 200 | |
|
201 | 201 | yield (pre, sucs, flags, metadata, date, parents) |
|
202 | 202 | |
|
203 | def _fm0encodeonemarker(marker): | |
|
204 | pre, sucs, flags, metadata, date, parents = marker | |
|
205 | metadata = decodemeta(metadata) | |
|
206 | metadata['date'] = '%d %i' % date | |
|
207 | if parents is not None: | |
|
208 | if not parents: | |
|
209 | # mark that we explicitly recorded no parents | |
|
210 | metadata['p0'] = '' | |
|
211 | for i, p in enumerate(parents): | |
|
212 | metadata['p%i' % (i + 1)] = node.hex(p) | |
|
213 | metadata = encodemeta(metadata) | |
|
214 | nbsuc = len(sucs) | |
|
215 | format = _fm0fixed + (_fm0node * nbsuc) | |
|
216 | data = [nbsuc, len(metadata), flags, pre] | |
|
217 | data.extend(sucs) | |
|
218 | return _pack(format, *data) + metadata | |
|
219 | ||
|
203 | 220 | def encodemeta(meta): |
|
204 | 221 | """Return encoded metadata string to string mapping. |
|
205 | 222 | |
@@ -430,23 +447,6 b' def _encodemarkers(markers, addheader=Fa' | |||
|
430 | 447 | yield _fm0encodeonemarker(marker) |
|
431 | 448 | |
|
432 | 449 | |
|
433 | def _fm0encodeonemarker(marker): | |
|
434 | pre, sucs, flags, metadata, date, parents = marker | |
|
435 | metadata = decodemeta(metadata) | |
|
436 | metadata['date'] = '%d %i' % date | |
|
437 | if parents is not None: | |
|
438 | if not parents: | |
|
439 | # mark that we explicitly recorded no parents | |
|
440 | metadata['p0'] = '' | |
|
441 | for i, p in enumerate(parents): | |
|
442 | metadata['p%i' % (i + 1)] = node.hex(p) | |
|
443 | metadata = encodemeta(metadata) | |
|
444 | nbsuc = len(sucs) | |
|
445 | format = _fm0fixed + (_fm0node * nbsuc) | |
|
446 | data = [nbsuc, len(metadata), flags, pre] | |
|
447 | data.extend(sucs) | |
|
448 | return _pack(format, *data) + metadata | |
|
449 | ||
|
450 | 450 | # arbitrary picked to fit into 8K limit from HTTP server |
|
451 | 451 | # you have to take in account: |
|
452 | 452 | # - the version header |
General Comments 0
You need to be logged in to leave comments.
Login now