changeset 51824:bcaa5d408657

typing: make the revlog classes known to pytype These are the same changes as c1d7ac70980b and 45270e286bdc made to dirstate, for the same reasons.
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 19 Aug 2024 22:46:09 -0400
parents 5eb98ea78fd7
children 766c55492258
files mercurial/revlog.py
diffstat 1 files changed, 18 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Mon Aug 19 22:27:43 2024 -0400
+++ b/mercurial/revlog.py	Mon Aug 19 22:46:09 2024 -0400
@@ -186,9 +186,8 @@
 )
 
 
-@interfaceutil.implementer(repository.irevisiondelta)
 @attr.s(slots=True)
-class revlogrevisiondelta:
+class RevLogRevisionDelta:
     node = attr.ib()
     p1node = attr.ib()
     p2node = attr.ib()
@@ -202,14 +201,29 @@
     linknode = attr.ib(default=None)
 
 
-@interfaceutil.implementer(repository.iverifyproblem)
+revlogrevisiondelta = interfaceutil.implementer(repository.irevisiondelta)(
+    RevLogRevisionDelta
+)
+
+if typing.TYPE_CHECKING:
+    revlogrevisiondelta = RevLogRevisionDelta
+
+
 @attr.s(frozen=True)
-class revlogproblem:
+class RevLogProblem:
     warning = attr.ib(default=None)
     error = attr.ib(default=None)
     node = attr.ib(default=None)
 
 
+revlogproblem = interfaceutil.implementer(repository.iverifyproblem)(
+    RevLogProblem
+)
+
+if typing.TYPE_CHECKING:
+    revlogproblem = RevLogProblem
+
+
 def parse_index_v1(data, inline):
     # call the C implementation to parse the index data
     index, cache = parsers.parse_index2(data, inline)