comparison mercurial/interfaces/repository.py @ 52478:d01af74e67b4

interfaces: convert `repository.imanifeststorage` from zope `Attribute` attrs This is the same transformation as b455dfddfed0 did for dirstate.
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 22 Oct 2024 22:41:04 -0400
parents 0c60be5e021a
children 99ca58c7cd0d
comparison
equal deleted inserted replaced
52477:d37d8dfe65bd 52478:d01af74e67b4
26 # to avoid circular imports 26 # to avoid circular imports
27 from ..utils import ( 27 from ..utils import (
28 urlutil, 28 urlutil,
29 ) 29 )
30 30
31 # TODO: make a protocol class for this
32 NodeConstants = Any
33
31 # TODO: create a Protocol class, since importing uimod here causes a cycle 34 # TODO: create a Protocol class, since importing uimod here causes a cycle
32 # that confuses pytype. 35 # that confuses pytype.
33 Ui = Any 36 Ui = Any
37
38 # TODO: make a protocol class for this
39 Vfs = Any
34 40
35 # Local repository feature string. 41 # Local repository feature string.
36 42
37 # Revlogs are being used for file storage. 43 # Revlogs are being used for file storage.
38 REPO_FEATURE_REVLOG_FILE_STORAGE = b'revlogfilestorage' 44 REPO_FEATURE_REVLOG_FILE_STORAGE = b'revlogfilestorage'
1295 1301
1296 1302
1297 class imanifeststorage(Protocol): 1303 class imanifeststorage(Protocol):
1298 """Storage interface for manifest data.""" 1304 """Storage interface for manifest data."""
1299 1305
1300 nodeconstants = interfaceutil.Attribute( 1306 nodeconstants: NodeConstants
1301 """nodeconstants used by the current repository.""" 1307 """nodeconstants used by the current repository."""
1302 ) 1308
1303 1309 tree: bytes
1304 tree = interfaceutil.Attribute( 1310 """The path to the directory this manifest tracks.
1305 """The path to the directory this manifest tracks. 1311
1306 1312 The empty bytestring represents the root manifest.
1307 The empty bytestring represents the root manifest. 1313 """
1308 """ 1314
1309 ) 1315 index: ifilerevisionssequence
1310 1316 """An ``ifilerevisionssequence`` instance."""
1311 index = interfaceutil.Attribute( 1317
1312 """An ``ifilerevisionssequence`` instance.""" 1318 opener: Vfs
1313 ) 1319 """VFS opener to use to access underlying files used for storage.
1314 1320
1315 opener = interfaceutil.Attribute( 1321 TODO this is revlog specific and should not be exposed.
1316 """VFS opener to use to access underlying files used for storage. 1322 """
1317 1323
1318 TODO this is revlog specific and should not be exposed. 1324 # TODO: finish type hints
1319 """ 1325 fulltextcache: dict
1320 ) 1326 """Dict with cache of fulltexts.
1321 1327
1322 fulltextcache = interfaceutil.Attribute( 1328 TODO this doesn't feel appropriate for the storage interface.
1323 """Dict with cache of fulltexts. 1329 """
1324
1325 TODO this doesn't feel appropriate for the storage interface.
1326 """
1327 )
1328 1330
1329 def __len__(self): 1331 def __len__(self):
1330 """Obtain the number of revisions stored for this manifest.""" 1332 """Obtain the number of revisions stored for this manifest."""
1331 1333
1332 def __iter__(self): 1334 def __iter__(self):