Mercurial > public > mercurial-scm > hg
comparison mercurial/linelog.py @ 49284:d44e3c45f0e4
py3: replace `pycompat.xrange` by `range`
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Sun, 29 May 2022 15:17:27 +0200 |
parents | 642e31cb55f0 |
children | 011eec5a66b2 |
comparison
equal
deleted
inserted
replaced
49283:44b26349127b | 49284:d44e3c45f0e4 |
---|---|
291 b"corrupt linelog data: claimed" | 291 b"corrupt linelog data: claimed" |
292 b" %d entries but given data for %d entries" | 292 b" %d entries but given data for %d entries" |
293 % (expected, numentries) | 293 % (expected, numentries) |
294 ) | 294 ) |
295 instructions = [_eof(0, 0)] | 295 instructions = [_eof(0, 0)] |
296 for offset in pycompat.xrange(1, numentries): | 296 for offset in range(1, numentries): |
297 instructions.append(_decodeone(buf, offset * _llentry.size)) | 297 instructions.append(_decodeone(buf, offset * _llentry.size)) |
298 return cls(instructions, maxrev=maxrev) | 298 return cls(instructions, maxrev=maxrev) |
299 | 299 |
300 def encode(self): | 300 def encode(self): |
301 hdr = _jge(self._maxrev, len(self._program)).encode() | 301 hdr = _jge(self._maxrev, len(self._program)).encode() |
347 # Determine the jump target for the JGE at the start of | 347 # Determine the jump target for the JGE at the start of |
348 # the new block. | 348 # the new block. |
349 tgt = oldproglen + (b2 - b1 + 1) | 349 tgt = oldproglen + (b2 - b1 + 1) |
350 # Jump to skip the insert if we're at an older revision. | 350 # Jump to skip the insert if we're at an older revision. |
351 appendinst(_jl(rev, tgt)) | 351 appendinst(_jl(rev, tgt)) |
352 for linenum in pycompat.xrange(b1, b2): | 352 for linenum in range(b1, b2): |
353 if _internal_blines is None: | 353 if _internal_blines is None: |
354 bappend(lineinfo(rev, linenum, programlen())) | 354 bappend(lineinfo(rev, linenum, programlen())) |
355 appendinst(_line(rev, linenum)) | 355 appendinst(_line(rev, linenum)) |
356 else: | 356 else: |
357 newrev, newlinenum = _internal_blines[linenum] | 357 newrev, newlinenum = _internal_blines[linenum] |
445 pc = start or 1 | 445 pc = start or 1 |
446 lines = [] | 446 lines = [] |
447 # only take as many steps as there are instructions in the | 447 # only take as many steps as there are instructions in the |
448 # program - if we don't find an EOF or our stop-line before | 448 # program - if we don't find an EOF or our stop-line before |
449 # then, something is badly broken. | 449 # then, something is badly broken. |
450 for step in pycompat.xrange(len(self._program)): | 450 for step in range(len(self._program)): |
451 inst = self._program[pc] | 451 inst = self._program[pc] |
452 nextpc = pc + 1 | 452 nextpc = pc + 1 |
453 if isinstance(inst, _jump): | 453 if isinstance(inst, _jump): |
454 nextpc = inst._target | 454 nextpc = inst._target |
455 elif isinstance(inst, _eof): | 455 elif isinstance(inst, _eof): |