Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revlog.py @ 52497:4ef6dbc27a99
revlog: subclass the new `repository.iverifyproblem` Protocol class
This is the same transformation as 3a90a6fd710d did for dirstate, but the
CamelCase naming was already cleaned up here.
We shouldn't have to explicitly subclass, but I'm doing so to test the interplay
of regular attributes and the `attrs` class. Also, PyCharm has a nifty feature
that puts a jump point in the gutter to navigate back and forth between the base
class and subclasses (and override functions and base class functions) when
there's an explicit subclassing. Additionally, PyCharm will immediately flag
signature mismatches without a 40m pytype run.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Tue, 22 Oct 2024 17:18:26 -0400 |
parents | 4eec920bbb37 |
children | 43d2a2f66434 |
comparison
equal
deleted
inserted
replaced
52496:f968926a4207 | 52497:4ef6dbc27a99 |
---|---|
202 protocol_flags = attr.ib() | 202 protocol_flags = attr.ib() |
203 linknode = attr.ib(default=None) | 203 linknode = attr.ib(default=None) |
204 | 204 |
205 | 205 |
206 @attr.s(frozen=True) | 206 @attr.s(frozen=True) |
207 class revlogproblem: # (repository.iverifyproblem) | 207 class revlogproblem(repository.iverifyproblem): |
208 warning = attr.ib(default=None, type=Optional[bytes]) | 208 warning = attr.ib(default=None, type=Optional[bytes]) |
209 error = attr.ib(default=None, type=Optional[bytes]) | 209 error = attr.ib(default=None, type=Optional[bytes]) |
210 node = attr.ib(default=None, type=Optional[bytes]) | 210 node = attr.ib(default=None, type=Optional[bytes]) |
211 | 211 |
212 | 212 |
4019 elif self._format_version == REVLOGV1: | 4019 elif self._format_version == REVLOGV1: |
4020 rewrite.v1_censor(self, tr, censor_nodes, tombstone) | 4020 rewrite.v1_censor(self, tr, censor_nodes, tombstone) |
4021 else: | 4021 else: |
4022 rewrite.v2_censor(self, tr, censor_nodes, tombstone) | 4022 rewrite.v2_censor(self, tr, censor_nodes, tombstone) |
4023 | 4023 |
4024 def verifyintegrity(self, state) -> Iterable[revlogproblem]: | 4024 def verifyintegrity(self, state) -> Iterable[repository.iverifyproblem]: |
4025 """Verifies the integrity of the revlog. | 4025 """Verifies the integrity of the revlog. |
4026 | 4026 |
4027 Yields ``revlogproblem`` instances describing problems that are | 4027 Yields ``revlogproblem`` instances describing problems that are |
4028 found. | 4028 found. |
4029 """ | 4029 """ |