##// END OF EJS Templates
readmarkers: drop temporary substring assignments...
Matt Mackall -
r23790:48284b8f default
parent child Browse files
Show More
@@ -290,9 +290,8 b' def _fm1readmarkers(data, off=0):'
290 l = len(data)
290 l = len(data)
291 while off + _fm1fsize <= l:
291 while off + _fm1fsize <= l:
292 # read fixed part
292 # read fixed part
293 cur = data[off:off + _fm1fsize]
293 fixeddata = _unpack(_fm1fixed, data[off:off + _fm1fsize])
294 off += _fm1fsize
294 off += _fm1fsize
295 fixeddata = _unpack(_fm1fixed, cur)
296 ttsize, seconds, tz, flags, numsuc, numpar, nummeta, prec = fixeddata
295 ttsize, seconds, tz, flags, numsuc, numpar, nummeta, prec = fixeddata
297 # extract the number of parents information
296 # extract the number of parents information
298 if numpar == _fm1parentnone:
297 if numpar == _fm1parentnone:
@@ -308,8 +307,7 b' def _fm1readmarkers(data, off=0):'
308 sucs = ()
307 sucs = ()
309 if numsuc:
308 if numsuc:
310 s = (fnodesize * numsuc)
309 s = (fnodesize * numsuc)
311 cur = data[off:off + s]
310 sucs = _unpack(_fm1node * numsuc, data[off:off + s])
312 sucs = _unpack(_fm1node * numsuc, cur)
313 off += s
311 off += s
314 # read parents
312 # read parents
315 if numpar is None:
313 if numpar is None:
@@ -318,8 +316,7 b' def _fm1readmarkers(data, off=0):'
318 parents = ()
316 parents = ()
319 elif numpar: # neither None nor zero
317 elif numpar: # neither None nor zero
320 s = (fnodesize * numpar)
318 s = (fnodesize * numpar)
321 cur = data[off:off + s]
319 parents = _unpack(_fm1node * numpar, data[off:off + s])
322 parents = _unpack(_fm1node * numpar, cur)
323 off += s
320 off += s
324 # read metadata
321 # read metadata
325 metaformat = '>' + (_fm1metapair * nummeta)
322 metaformat = '>' + (_fm1metapair * nummeta)
@@ -330,11 +327,7 b' def _fm1readmarkers(data, off=0):'
330 for idx in xrange(0, len(metapairsize), 2):
327 for idx in xrange(0, len(metapairsize), 2):
331 sk = metapairsize[idx]
328 sk = metapairsize[idx]
332 sv = metapairsize[idx + 1]
329 sv = metapairsize[idx + 1]
333 key = data[off:off + sk]
330 metadata.append((data[off:off + sk], data[off + sk:off + sk + sv]))
334 value = data[off + sk:off + sk + sv]
335 assert len(key) == sk
336 assert len(value) == sv
337 metadata.append((key, value))
338 off += sk + sv
331 off += sk + sv
339 metadata = tuple(metadata)
332 metadata = tuple(metadata)
340
333
General Comments 0
You need to be logged in to leave comments. Login now