changeset 51822:e78b75f3cea9

typing: make the filelog class 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:21:16 -0400
parents c371134fef01
children 5eb98ea78fd7
files mercurial/filelog.py
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/filelog.py	Wed Aug 21 17:41:57 2024 -0400
+++ b/mercurial/filelog.py	Mon Aug 19 22:21:16 2024 -0400
@@ -6,6 +6,8 @@
 # GNU General Public License version 2 or any later version.
 
 
+import typing
+
 from .i18n import _
 from .node import nullrev
 from . import (
@@ -23,8 +25,7 @@
 )
 
 
-@interfaceutil.implementer(repository.ifilestorage)
-class filelog:
+class FileLog:
     def __init__(self, opener, path, try_split=False):
         self._revlog = revlog.revlog(
             opener,
@@ -262,6 +263,12 @@
         return self._revlog.clone(tr, destrevlog._revlog, **kwargs)
 
 
+filelog = interfaceutil.implementer(repository.ifilestorage)(FileLog)
+
+if typing.TYPE_CHECKING:
+    filelog = FileLog
+
+
 class narrowfilelog(filelog):
     """Filelog variation to be used with narrow stores."""