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