##// END OF EJS Templates
interfaces: convert `imanifestrevisionstored` to a Protocol class...
Matt Harbison -
r53757:cdd4bc69 default
parent child Browse files
Show More
@@ -8,6 +8,7
8
8
9 from __future__ import annotations
9 from __future__ import annotations
10
10
11 import abc
11 import typing
12 import typing
12
13
13 from typing import (
14 from typing import (
@@ -1171,15 +1172,17 class imanifestrevisionbase(Protocol):
1171 """
1172 """
1172
1173
1173
1174
1174 class imanifestrevisionstored(imanifestrevisionbase):
1175 class imanifestrevisionstored(imanifestrevisionbase, Protocol):
1175 """Interface representing a manifest revision committed to storage."""
1176 """Interface representing a manifest revision committed to storage."""
1176
1177
1178 @abc.abstractmethod
1177 def node(self) -> bytes:
1179 def node(self) -> bytes:
1178 """The binary node for this manifest."""
1180 """The binary node for this manifest."""
1179
1181
1180 parents: list[bytes]
1182 parents: list[bytes]
1181 """List of binary nodes that are parents for this manifest revision."""
1183 """List of binary nodes that are parents for this manifest revision."""
1182
1184
1185 @abc.abstractmethod
1183 def readdelta(self, shallow: bool = False):
1186 def readdelta(self, shallow: bool = False):
1184 """Obtain the manifest data structure representing changes from parent.
1187 """Obtain the manifest data structure representing changes from parent.
1185
1188
@@ -1195,6 +1198,7 class imanifestrevisionstored(imanifestr
1195 The returned object conforms to the ``imanifestdict`` interface.
1198 The returned object conforms to the ``imanifestdict`` interface.
1196 """
1199 """
1197
1200
1201 @abc.abstractmethod
1198 def read_any_fast_delta(
1202 def read_any_fast_delta(
1199 self,
1203 self,
1200 valid_bases: Collection[int] | None = None,
1204 valid_bases: Collection[int] | None = None,
@@ -1223,6 +1227,7 class imanifestrevisionstored(imanifestr
1223 The returned object conforms to the ``imanifestdict`` interface.
1227 The returned object conforms to the ``imanifestdict`` interface.
1224 """
1228 """
1225
1229
1230 @abc.abstractmethod
1226 def read_delta_parents(self, *, shallow: bool = False, exact: bool = True):
1231 def read_delta_parents(self, *, shallow: bool = False, exact: bool = True):
1227 """return a diff from this revision against both parents.
1232 """return a diff from this revision against both parents.
1228
1233
@@ -1237,6 +1242,7 class imanifestrevisionstored(imanifestr
1237
1242
1238 The returned object conforms to the ``imanifestdict`` interface."""
1243 The returned object conforms to the ``imanifestdict`` interface."""
1239
1244
1245 @abc.abstractmethod
1240 def read_delta_new_entries(self, *, shallow: bool = False):
1246 def read_delta_new_entries(self, *, shallow: bool = False):
1241 """Return a manifest containing just the entries that might be new to
1247 """Return a manifest containing just the entries that might be new to
1242 the repository.
1248 the repository.
@@ -1252,12 +1258,14 class imanifestrevisionstored(imanifestr
1252
1258
1253 The returned object conforms to the ``imanifestdict`` interface."""
1259 The returned object conforms to the ``imanifestdict`` interface."""
1254
1260
1261 @abc.abstractmethod
1255 def readfast(self, shallow: bool = False):
1262 def readfast(self, shallow: bool = False):
1256 """Calls either ``read()`` or ``readdelta()``.
1263 """Calls either ``read()`` or ``readdelta()``.
1257
1264
1258 The faster of the two options is called.
1265 The faster of the two options is called.
1259 """
1266 """
1260
1267
1268 @abc.abstractmethod
1261 def find(self, key: bytes) -> tuple[bytes, bytes]:
1269 def find(self, key: bytes) -> tuple[bytes, bytes]:
1262 """Calls self.read().find(key)``.
1270 """Calls self.read().find(key)``.
1263
1271
General Comments 0
You need to be logged in to leave comments. Login now