Show More
@@ -99,11 +99,11 b' from i18n import _' | |||
|
99 | 99 | _enabled = False |
|
100 | 100 | |
|
101 | 101 | # data used for parsing and writing |
|
102 | _fmversion = 0 | |
|
103 | _fmfixed = '>BIB20s' | |
|
104 | _fmnode = '20s' | |
|
105 | _fmfsize = struct.calcsize(_fmfixed) | |
|
106 | _fmfnodesize = struct.calcsize(_fmnode) | |
|
102 | _fm0version = 0 | |
|
103 | _fm0fixed = '>BIB20s' | |
|
104 | _fm0node = '20s' | |
|
105 | _fm0fsize = struct.calcsize(_fm0fixed) | |
|
106 | _fm0fnodesize = struct.calcsize(_fm0node) | |
|
107 | 107 | |
|
108 | 108 | ### obsolescence marker flag |
|
109 | 109 | |
@@ -142,23 +142,23 b' def _readmarkers(data):' | |||
|
142 | 142 | off = 0 |
|
143 | 143 | diskversion = _unpack('>B', data[off:off + 1])[0] |
|
144 | 144 | off += 1 |
|
145 | if diskversion != _fmversion: | |
|
145 | if diskversion != _fm0version: | |
|
146 | 146 | raise util.Abort(_('parsing obsolete marker: unknown version %r') |
|
147 | 147 | % diskversion) |
|
148 | 148 | |
|
149 | 149 | # Loop on markers |
|
150 | 150 | l = len(data) |
|
151 | while off + _fmfsize <= l: | |
|
151 | while off + _fm0fsize <= l: | |
|
152 | 152 | # read fixed part |
|
153 | cur = data[off:off + _fmfsize] | |
|
154 | off += _fmfsize | |
|
155 | nbsuc, mdsize, flags, pre = _unpack(_fmfixed, cur) | |
|
153 | cur = data[off:off + _fm0fsize] | |
|
154 | off += _fm0fsize | |
|
155 | nbsuc, mdsize, flags, pre = _unpack(_fm0fixed, cur) | |
|
156 | 156 | # read replacement |
|
157 | 157 | sucs = () |
|
158 | 158 | if nbsuc: |
|
159 | s = _fmfnodesize * nbsuc | |
|
159 | s = (_fm0fnodesize * nbsuc) | |
|
160 | 160 | cur = data[off:off + s] |
|
161 | sucs = _unpack(_fmnode * nbsuc, cur) | |
|
161 | sucs = _unpack(_fm0node * nbsuc, cur) | |
|
162 | 162 | off += s |
|
163 | 163 | # read metadata |
|
164 | 164 | # (metadata will be decoded on demand) |
@@ -422,7 +422,7 b' def _encodemarkers(markers, addheader=Fa' | |||
|
422 | 422 | # Kept separate from flushmarkers(), it will be reused for |
|
423 | 423 | # markers exchange. |
|
424 | 424 | if addheader: |
|
425 | yield _pack('>B', _fmversion) | |
|
425 | yield _pack('>B', _fm0version) | |
|
426 | 426 | for marker in markers: |
|
427 | 427 | yield _encodeonemarker(marker) |
|
428 | 428 | |
@@ -439,7 +439,7 b' def _encodeonemarker(marker):' | |||
|
439 | 439 | metadata['p%i' % (i + 1)] = node.hex(p) |
|
440 | 440 | metadata = encodemeta(metadata) |
|
441 | 441 | nbsuc = len(sucs) |
|
442 | format = _fmfixed + (_fmnode * nbsuc) | |
|
442 | format = _fm0fixed + (_fm0node * nbsuc) | |
|
443 | 443 | data = [nbsuc, len(metadata), flags, pre] |
|
444 | 444 | data.extend(sucs) |
|
445 | 445 | return _pack(format, *data) + metadata |
@@ -467,7 +467,7 b' def _pushkeyescape(markers):' | |||
|
467 | 467 | currentpart.append(nextdata) |
|
468 | 468 | currentlen += len(nextdata) |
|
469 | 469 | for idx, part in enumerate(reversed(parts)): |
|
470 | data = ''.join([_pack('>B', _fmversion)] + part) | |
|
470 | data = ''.join([_pack('>B', _fm0version)] + part) | |
|
471 | 471 | keys['dump%i' % idx] = base85.b85encode(data) |
|
472 | 472 | return keys |
|
473 | 473 |
General Comments 0
You need to be logged in to leave comments.
Login now