comparison mercurial/interfaces/repository.py @ 52483:196f441ffc93

interfaces: make `repository.imanifestlog` methods abstract Same as cdd4bc69bfc1 for `imanifestrevisionstored`, but this was already a Protocol class.
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 10 Dec 2024 21:59:26 -0500
parents ed70604d6e07
children dfb60fb155da
comparison
equal deleted inserted replaced
52482:ed70604d6e07 52483:196f441ffc93
1556 """nodeconstants used by the current repository.""" 1556 """nodeconstants used by the current repository."""
1557 1557
1558 narrowed: bool 1558 narrowed: bool
1559 """True, is the manifest is narrowed by a matcher""" 1559 """True, is the manifest is narrowed by a matcher"""
1560 1560
1561 @abc.abstractmethod
1561 def __getitem__(self, node): 1562 def __getitem__(self, node):
1562 """Obtain a manifest instance for a given binary node. 1563 """Obtain a manifest instance for a given binary node.
1563 1564
1564 Equivalent to calling ``self.get('', node)``. 1565 Equivalent to calling ``self.get('', node)``.
1565 1566
1566 The returned object conforms to the ``imanifestrevisionstored`` 1567 The returned object conforms to the ``imanifestrevisionstored``
1567 interface. 1568 interface.
1568 """ 1569 """
1569 1570
1571 @abc.abstractmethod
1570 def get(self, tree, node, verify=True): 1572 def get(self, tree, node, verify=True):
1571 """Retrieve the manifest instance for a given directory and binary node. 1573 """Retrieve the manifest instance for a given directory and binary node.
1572 1574
1573 ``node`` always refers to the node of the root manifest (which will be 1575 ``node`` always refers to the node of the root manifest (which will be
1574 the only manifest if flat manifests are being used). 1576 the only manifest if flat manifests are being used).
1582 1584
1583 The returned object conforms to the ``imanifestrevisionstored`` 1585 The returned object conforms to the ``imanifestrevisionstored``
1584 interface. 1586 interface.
1585 """ 1587 """
1586 1588
1589 @abc.abstractmethod
1587 def getstorage(self, tree): 1590 def getstorage(self, tree):
1588 """Retrieve an interface to storage for a particular tree. 1591 """Retrieve an interface to storage for a particular tree.
1589 1592
1590 If ``tree`` is the empty bytestring, storage for the root manifest will 1593 If ``tree`` is the empty bytestring, storage for the root manifest will
1591 be returned. Otherwise storage for a tree manifest is returned. 1594 be returned. Otherwise storage for a tree manifest is returned.
1592 1595
1593 TODO formalize interface for returned object. 1596 TODO formalize interface for returned object.
1594 """ 1597 """
1595 1598
1599 @abc.abstractmethod
1596 def clearcaches(self, clear_persisted_data: bool = False) -> None: 1600 def clearcaches(self, clear_persisted_data: bool = False) -> None:
1597 """Clear caches associated with this collection.""" 1601 """Clear caches associated with this collection."""
1598 1602
1603 @abc.abstractmethod
1599 def rev(self, node): 1604 def rev(self, node):
1600 """Obtain the revision number for a binary node. 1605 """Obtain the revision number for a binary node.
1601 1606
1602 Raises ``error.LookupError`` if the node is not known. 1607 Raises ``error.LookupError`` if the node is not known.
1603 """ 1608 """
1604 1609
1610 @abc.abstractmethod
1605 def update_caches(self, transaction): 1611 def update_caches(self, transaction):
1606 """update whatever cache are relevant for the used storage.""" 1612 """update whatever cache are relevant for the used storage."""
1607 1613
1608 1614
1609 class ilocalrepositoryfilestorage(Protocol): 1615 class ilocalrepositoryfilestorage(Protocol):