localrepo: subclass the new `ilocalrepositoryfilestorage` Protocol class
authorMatt Harbison <matt_harbison@yahoo.com>
Wed, 23 Oct 2024 15:13:40 -0400
changeset 52490 ef119f914fc1
parent 52489 ba8f03ad8906
child 52491 c855943e334b
localrepo: subclass the new `ilocalrepositoryfilestorage` Protocol class This is the same transformation as 3a90a6fd710d did for dirstate, but the CamelCase naming was already cleaned up here. See 4ef6dbc27a99 for the benefits of explicit subclassing. Since there's only one method in this Protocol class and it needs to be abstract because of the direct subclassing (see cdd4bc69bfc1), do that here.
hgext/sqlitestore.py
mercurial/interfaces/repository.py
mercurial/localrepo.py
--- a/hgext/sqlitestore.py	Tue Oct 22 23:36:48 2024 -0400
+++ b/hgext/sqlitestore.py	Wed Oct 23 15:13:40 2024 -0400
@@ -86,7 +86,6 @@
 )
 from mercurial.interfaces import (
     repository,
-    util as interfaceutil,
 )
 from mercurial.utils import (
     hashutil,
@@ -1282,8 +1281,7 @@
     return requirements
 
 
-@interfaceutil.implementer(repository.ilocalrepositoryfilestorage)
-class sqlitefilestorage:
+class sqlitefilestorage(repository.ilocalrepositoryfilestorage):
     """Repository file storage backed by SQLite."""
 
     def file(self, path):
--- a/mercurial/interfaces/repository.py	Tue Oct 22 23:36:48 2024 -0400
+++ b/mercurial/interfaces/repository.py	Wed Oct 23 15:13:40 2024 -0400
@@ -1658,6 +1658,7 @@
     tracked file path.
     """
 
+    @abc.abstractmethod
     def file(self, f):
         """Obtain a filelog for a tracked path.
 
--- a/mercurial/localrepo.py	Tue Oct 22 23:36:48 2024 -0400
+++ b/mercurial/localrepo.py	Wed Oct 23 15:13:40 2024 -0400
@@ -1241,7 +1241,7 @@
     return localrepository
 
 
-class revlogfilestorage:  # (repository.ilocalrepositoryfilestorage)
+class revlogfilestorage(repository.ilocalrepositoryfilestorage):
     """File storage when using revlogs."""
 
     def file(self, path):
@@ -1256,7 +1256,7 @@
         return filelog.filelog(self.svfs, path, try_split=try_split)
 
 
-class revlognarrowfilestorage:  # (repository.ilocalrepositoryfilestorage)
+class revlognarrowfilestorage(repository.ilocalrepositoryfilestorage):
     """File storage when using revlogs and narrow files."""
 
     def file(self, path):