comparison mercurial/localrepo.py @ 52490:ef119f914fc1

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.
author Matt Harbison <matt_harbison@yahoo.com>
date Wed, 23 Oct 2024 15:13:40 -0400
parents 0a81f3ef054c
children e123c8a26a70
comparison
equal deleted inserted replaced
52489:ba8f03ad8906 52490:ef119f914fc1
1239 def makemain(**kwargs): 1239 def makemain(**kwargs):
1240 """Produce a type conforming to ``ilocalrepositorymain``.""" 1240 """Produce a type conforming to ``ilocalrepositorymain``."""
1241 return localrepository 1241 return localrepository
1242 1242
1243 1243
1244 class revlogfilestorage: # (repository.ilocalrepositoryfilestorage) 1244 class revlogfilestorage(repository.ilocalrepositoryfilestorage):
1245 """File storage when using revlogs.""" 1245 """File storage when using revlogs."""
1246 1246
1247 def file(self, path): 1247 def file(self, path):
1248 if path.startswith(b'/'): 1248 if path.startswith(b'/'):
1249 path = path[1:] 1249 path = path[1:]
1254 ) 1254 )
1255 1255
1256 return filelog.filelog(self.svfs, path, try_split=try_split) 1256 return filelog.filelog(self.svfs, path, try_split=try_split)
1257 1257
1258 1258
1259 class revlognarrowfilestorage: # (repository.ilocalrepositoryfilestorage) 1259 class revlognarrowfilestorage(repository.ilocalrepositoryfilestorage):
1260 """File storage when using revlogs and narrow files.""" 1260 """File storage when using revlogs and narrow files."""
1261 1261
1262 def file(self, path): 1262 def file(self, path):
1263 if path.startswith(b'/'): 1263 if path.startswith(b'/'):
1264 path = path[1:] 1264 path = path[1:]