Mercurial > hg
comparison mercurial/linelog.py @ 51727:a65c2dddbf5d
linelog: correct the default value of `annotateresult.lines`
This was flagged by pytype once it was tricked into using the standard `attr`
package instead of the vendored copy.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Tue, 23 Jul 2024 19:05:26 -0400 |
parents | ca7bde5dbafb |
children | 278af66e6595 |
comparison
equal
deleted
inserted
replaced
51726:587153c96fe3 | 51727:a65c2dddbf5d |
---|---|
19 in a new body of annotate information. | 19 in a new body of annotate information. |
20 """ | 20 """ |
21 | 21 |
22 import abc | 22 import abc |
23 import struct | 23 import struct |
24 import typing | |
25 | |
26 from typing import ( | |
27 List, | |
28 ) | |
24 | 29 |
25 from .thirdparty import attr | 30 from .thirdparty import attr |
26 from . import pycompat | 31 from . import pycompat |
27 | 32 |
28 _llentry = struct.Struct(b'>II') | 33 _llentry = struct.Struct(b'>II') |
43 | 48 |
44 | 49 |
45 @attr.s | 50 @attr.s |
46 class annotateresult: | 51 class annotateresult: |
47 rev = attr.ib() | 52 rev = attr.ib() |
48 lines = attr.ib(type=bytearray) | 53 lines = attr.ib(type=List[lineinfo]) |
49 _eof = attr.ib() | 54 _eof = attr.ib() |
50 | 55 |
51 def __iter__(self): | 56 def __iter__(self): |
52 return iter(self.lines) | 57 return iter(self.lines) |
53 | 58 |
398 if rev > self._maxrev: | 403 if rev > self._maxrev: |
399 self._maxrev = rev | 404 self._maxrev = rev |
400 | 405 |
401 def annotate(self, rev): | 406 def annotate(self, rev): |
402 pc = 1 | 407 pc = 1 |
403 lines = [] | 408 lines: List[lineinfo] = [] |
404 executed = 0 | 409 executed = 0 |
405 # Sanity check: if instructions executed exceeds len(program), we | 410 # Sanity check: if instructions executed exceeds len(program), we |
406 # hit an infinite loop in the linelog program somehow and we | 411 # hit an infinite loop in the linelog program somehow and we |
407 # should stop. | 412 # should stop. |
408 while pc is not None and executed < len(self._program): | 413 while pc is not None and executed < len(self._program): |