##// END OF EJS Templates
typing: (mostly) align the signatures of `imanifestrevisionstored` overrides...
Matt Harbison -
r53371:048c1199 default
parent child Browse files
Show More
@@ -268,7 +268,7 class gittreemanifestctx:
268 def read(self):
268 def read(self):
269 return gittreemanifest(self._repo, self._tree, None)
269 return gittreemanifest(self._repo, self._tree, None)
270
270
271 def readfast(self, shallow=False):
271 def readfast(self, shallow: bool = False):
272 return self.read()
272 return self.read()
273
273
274 def copy(self):
274 def copy(self):
@@ -276,7 +276,7 class gittreemanifestctx:
276 # because the caller expects a mutable manifest.
276 # because the caller expects a mutable manifest.
277 return memgittreemanifestctx(self._repo, self._tree)
277 return memgittreemanifestctx(self._repo, self._tree)
278
278
279 def find(self, path):
279 def find(self, path: bytes) -> tuple[bytes, bytes]:
280 return self.read()[path]
280 return self.read()[path]
281
281
282
282
@@ -12,6 +12,7 import typing
12
12
13 from typing import (
13 from typing import (
14 Any,
14 Any,
15 Collection,
15 Protocol,
16 Protocol,
16 )
17 )
17
18
@@ -1173,13 +1174,13 class imanifestrevisionbase(Protocol):
1173 class imanifestrevisionstored(imanifestrevisionbase):
1174 class imanifestrevisionstored(imanifestrevisionbase):
1174 """Interface representing a manifest revision committed to storage."""
1175 """Interface representing a manifest revision committed to storage."""
1175
1176
1176 def node(self):
1177 def node(self) -> bytes:
1177 """The binary node for this manifest."""
1178 """The binary node for this manifest."""
1178
1179
1179 parents: list[bytes]
1180 parents: list[bytes]
1180 """List of binary nodes that are parents for this manifest revision."""
1181 """List of binary nodes that are parents for this manifest revision."""
1181
1182
1182 def readdelta(self, shallow=False):
1183 def readdelta(self, shallow: bool = False):
1183 """Obtain the manifest data structure representing changes from parent.
1184 """Obtain the manifest data structure representing changes from parent.
1184
1185
1185 This manifest is compared to its 1st parent. A new manifest
1186 This manifest is compared to its 1st parent. A new manifest
@@ -1194,7 +1195,12 class imanifestrevisionstored(imanifestr
1194 The returned object conforms to the ``imanifestdict`` interface.
1195 The returned object conforms to the ``imanifestdict`` interface.
1195 """
1196 """
1196
1197
1197 def read_any_fast_delta(self, valid_bases=None, *, shallow=False):
1198 def read_any_fast_delta(
1199 self,
1200 valid_bases: Collection[int] | None = None,
1201 *,
1202 shallow: bool = False,
1203 ):
1198 """read some manifest information as fast if possible
1204 """read some manifest information as fast if possible
1199
1205
1200 This might return a "delta", a manifest object containing only file
1206 This might return a "delta", a manifest object containing only file
@@ -1217,7 +1223,7 class imanifestrevisionstored(imanifestr
1217 The returned object conforms to the ``imanifestdict`` interface.
1223 The returned object conforms to the ``imanifestdict`` interface.
1218 """
1224 """
1219
1225
1220 def read_delta_parents(self, *, shallow=False, exact=True):
1226 def read_delta_parents(self, *, shallow: bool = False, exact: bool = True):
1221 """return a diff from this revision against both parents.
1227 """return a diff from this revision against both parents.
1222
1228
1223 If `exact` is False, this might return a superset of the diff, containing
1229 If `exact` is False, this might return a superset of the diff, containing
@@ -1231,7 +1237,7 class imanifestrevisionstored(imanifestr
1231
1237
1232 The returned object conforms to the ``imanifestdict`` interface."""
1238 The returned object conforms to the ``imanifestdict`` interface."""
1233
1239
1234 def read_delta_new_entries(self, *, shallow=False):
1240 def read_delta_new_entries(self, *, shallow: bool = False):
1235 """Return a manifest containing just the entries that might be new to
1241 """Return a manifest containing just the entries that might be new to
1236 the repository.
1242 the repository.
1237
1243
@@ -1246,13 +1252,13 class imanifestrevisionstored(imanifestr
1246
1252
1247 The returned object conforms to the ``imanifestdict`` interface."""
1253 The returned object conforms to the ``imanifestdict`` interface."""
1248
1254
1249 def readfast(self, shallow=False):
1255 def readfast(self, shallow: bool = False):
1250 """Calls either ``read()`` or ``readdelta()``.
1256 """Calls either ``read()`` or ``readdelta()``.
1251
1257
1252 The faster of the two options is called.
1258 The faster of the two options is called.
1253 """
1259 """
1254
1260
1255 def find(self, key):
1261 def find(self, key: bytes) -> tuple[bytes, bytes]:
1256 """Calls self.read().find(key)``.
1262 """Calls self.read().find(key)``.
1257
1263
1258 Returns a 2-tuple of ``(node, flags)`` or raises ``KeyError``.
1264 Returns a 2-tuple of ``(node, flags)`` or raises ``KeyError``.
@@ -2332,7 +2332,7 class manifestctx: # (repository.imanif
2332 md.set(f, new_node, new_flag)
2332 md.set(f, new_node, new_flag)
2333 return md
2333 return md
2334
2334
2335 def read_delta_new_entries(self, *, shallow=False) -> manifestdict:
2335 def read_delta_new_entries(self, *, shallow: bool = False) -> manifestdict:
2336 """see `interface.imanifestrevisionbase` documentations"""
2336 """see `interface.imanifestrevisionbase` documentations"""
2337 # If we are using narrow, returning a delta against an arbitrary
2337 # If we are using narrow, returning a delta against an arbitrary
2338 # changeset might return file outside the narrowspec. This can create
2338 # changeset might return file outside the narrowspec. This can create
@@ -2621,7 +2621,7 class treemanifestctx: # (repository.im
2621 bases = (store.deltaparent(r),)
2621 bases = (store.deltaparent(r),)
2622 return self.read_any_fast_delta(bases, shallow=shallow)[1]
2622 return self.read_any_fast_delta(bases, shallow=shallow)[1]
2623
2623
2624 def readfast(self, shallow=False) -> AnyManifestDict:
2624 def readfast(self, shallow: bool = False) -> AnyManifestDict:
2625 """Calls either readdelta or read, based on which would be less work.
2625 """Calls either readdelta or read, based on which would be less work.
2626 readdelta is called if the delta is against the p1, and therefore can be
2626 readdelta is called if the delta is against the p1, and therefore can be
2627 read quickly.
2627 read quickly.
@@ -2694,7 +2694,7 class excludeddirmanifestctx(treemanifes
2694 def read(self):
2694 def read(self):
2695 return excludeddir(self.nodeconstants, self._dir, self._node)
2695 return excludeddir(self.nodeconstants, self._dir, self._node)
2696
2696
2697 def readfast(self, shallow=False):
2697 def readfast(self, shallow: bool = False):
2698 # special version of readfast since we don't have underlying storage
2698 # special version of readfast since we don't have underlying storage
2699 return self.read()
2699 return self.read()
2700
2700
General Comments 0
You need to be logged in to leave comments. Login now