Show More
@@ -504,7 +504,7 except AttributeError: | |||||
504 | _lazymanifest = _LazyManifest |
|
504 | _lazymanifest = _LazyManifest | |
505 |
|
505 | |||
506 |
|
506 | |||
507 | class ManifestDict: |
|
507 | class manifestdict: # (repository.imanifestdict) | |
508 | def __init__(self, nodelen: int, data: ByteString = b''): |
|
508 | def __init__(self, nodelen: int, data: ByteString = b''): | |
509 | self._nodelen = nodelen |
|
509 | self._nodelen = nodelen | |
510 | self._lm = _lazymanifest(nodelen, data) |
|
510 | self._lm = _lazymanifest(nodelen, data) | |
@@ -612,7 +612,7 class ManifestDict: | |||||
612 | if not self.hasdir(fn): |
|
612 | if not self.hasdir(fn): | |
613 | match.bad(fn, None) |
|
613 | match.bad(fn, None) | |
614 |
|
614 | |||
615 |
def _matches(self, match: matchmod.basematcher) -> ' |
|
615 | def _matches(self, match: matchmod.basematcher) -> 'manifestdict': | |
616 | '''generate a new manifest filtered by the match argument''' |
|
616 | '''generate a new manifest filtered by the match argument''' | |
617 | if match.always(): |
|
617 | if match.always(): | |
618 | return self.copy() |
|
618 | return self.copy() | |
@@ -631,7 +631,7 class ManifestDict: | |||||
631 |
|
631 | |||
632 | def diff( |
|
632 | def diff( | |
633 | self, |
|
633 | self, | |
634 |
m2: ' |
|
634 | m2: 'manifestdict', | |
635 | match: Optional[matchmod.basematcher] = None, |
|
635 | match: Optional[matchmod.basematcher] = None, | |
636 | clean: bool = False, |
|
636 | clean: bool = False, | |
637 | ) -> Dict[ |
|
637 | ) -> Dict[ | |
@@ -677,7 +677,7 class ManifestDict: | |||||
677 | except KeyError: |
|
677 | except KeyError: | |
678 | return b'' |
|
678 | return b'' | |
679 |
|
679 | |||
680 |
def copy(self) -> ' |
|
680 | def copy(self) -> 'manifestdict': | |
681 | c = manifestdict(self._nodelen) |
|
681 | c = manifestdict(self._nodelen) | |
682 | c._lm = self._lm.copy() |
|
682 | c._lm = self._lm.copy() | |
683 | return c |
|
683 | return c | |
@@ -753,12 +753,6 class ManifestDict: | |||||
753 | return arraytext, deltatext |
|
753 | return arraytext, deltatext | |
754 |
|
754 | |||
755 |
|
755 | |||
756 | manifestdict = interfaceutil.implementer(repository.imanifestdict)(ManifestDict) |
|
|||
757 |
|
||||
758 | if typing.TYPE_CHECKING: |
|
|||
759 | manifestdict = ManifestDict |
|
|||
760 |
|
||||
761 |
|
||||
762 | def _msearch( |
|
756 | def _msearch( | |
763 | m: ByteString, s: bytes, lo: int = 0, hi: Optional[int] = None |
|
757 | m: ByteString, s: bytes, lo: int = 0, hi: Optional[int] = None | |
764 | ) -> Tuple[int, int]: |
|
758 | ) -> Tuple[int, int]: | |
@@ -2065,7 +2059,7 if typing.TYPE_CHECKING: | |||||
2065 | manifestrevlog = ManifestRevlog |
|
2059 | manifestrevlog = ManifestRevlog | |
2066 |
|
2060 | |||
2067 | AnyManifestCtx = Union['ManifestCtx', 'TreeManifestCtx'] |
|
2061 | AnyManifestCtx = Union['ManifestCtx', 'TreeManifestCtx'] | |
2068 |
AnyManifestDict = Union[ |
|
2062 | AnyManifestDict = Union[manifestdict, TreeManifest] | |
2069 |
|
2063 | |||
2070 |
|
2064 | |||
2071 | class ManifestLog: |
|
2065 | class ManifestLog: | |
@@ -2179,7 +2173,7 if typing.TYPE_CHECKING: | |||||
2179 |
|
2173 | |||
2180 |
|
2174 | |||
2181 | class MemManifestCtx: |
|
2175 | class MemManifestCtx: | |
2182 |
_manifestdict: |
|
2176 | _manifestdict: manifestdict | |
2183 |
|
2177 | |||
2184 | def __init__(self, manifestlog): |
|
2178 | def __init__(self, manifestlog): | |
2185 | self._manifestlog = manifestlog |
|
2179 | self._manifestlog = manifestlog | |
@@ -2193,7 +2187,7 class MemManifestCtx: | |||||
2193 | memmf._manifestdict = self.read().copy() |
|
2187 | memmf._manifestdict = self.read().copy() | |
2194 | return memmf |
|
2188 | return memmf | |
2195 |
|
2189 | |||
2196 |
def read(self) -> ' |
|
2190 | def read(self) -> 'manifestdict': | |
2197 | return self._manifestdict |
|
2191 | return self._manifestdict | |
2198 |
|
2192 | |||
2199 | def write(self, transaction, link, p1, p2, added, removed, match=None): |
|
2193 | def write(self, transaction, link, p1, p2, added, removed, match=None): | |
@@ -2222,7 +2216,7 class ManifestCtx: | |||||
2222 | contents, its parent revs, and its linkrev. |
|
2216 | contents, its parent revs, and its linkrev. | |
2223 | """ |
|
2217 | """ | |
2224 |
|
2218 | |||
2225 |
_data: Optional[ |
|
2219 | _data: Optional[manifestdict] | |
2226 |
|
2220 | |||
2227 | def __init__(self, manifestlog, node): |
|
2221 | def __init__(self, manifestlog, node): | |
2228 | self._manifestlog = manifestlog |
|
2222 | self._manifestlog = manifestlog | |
@@ -2252,7 +2246,7 class ManifestCtx: | |||||
2252 | def parents(self) -> Tuple[bytes, bytes]: |
|
2246 | def parents(self) -> Tuple[bytes, bytes]: | |
2253 | return self._storage().parents(self._node) |
|
2247 | return self._storage().parents(self._node) | |
2254 |
|
2248 | |||
2255 |
def read(self) -> ' |
|
2249 | def read(self) -> 'manifestdict': | |
2256 | if self._data is None: |
|
2250 | if self._data is None: | |
2257 | nc = self._manifestlog.nodeconstants |
|
2251 | nc = self._manifestlog.nodeconstants | |
2258 | if self._node == nc.nullid: |
|
2252 | if self._node == nc.nullid: | |
@@ -2268,7 +2262,7 class ManifestCtx: | |||||
2268 | self._data = manifestdict(nc.nodelen, text) |
|
2262 | self._data = manifestdict(nc.nodelen, text) | |
2269 | return self._data |
|
2263 | return self._data | |
2270 |
|
2264 | |||
2271 |
def readfast(self, shallow: bool = False) -> ' |
|
2265 | def readfast(self, shallow: bool = False) -> 'manifestdict': | |
2272 | """Calls either readdelta or read, based on which would be less work. |
|
2266 | """Calls either readdelta or read, based on which would be less work. | |
2273 | readdelta is called if the delta is against the p1, and therefore can be |
|
2267 | readdelta is called if the delta is against the p1, and therefore can be | |
2274 | read quickly. |
|
2268 | read quickly. | |
@@ -2287,7 +2281,7 class ManifestCtx: | |||||
2287 | return self.readdelta() |
|
2281 | return self.readdelta() | |
2288 | return self.read() |
|
2282 | return self.read() | |
2289 |
|
2283 | |||
2290 |
def readdelta(self, shallow: bool = False) -> ' |
|
2284 | def readdelta(self, shallow: bool = False) -> 'manifestdict': | |
2291 | """Returns a manifest containing just the entries that are present |
|
2285 | """Returns a manifest containing just the entries that are present | |
2292 | in this manifest, but not in its p1 manifest. This is efficient to read |
|
2286 | in this manifest, but not in its p1 manifest. This is efficient to read | |
2293 | if the revlog delta is already p1. |
|
2287 | if the revlog delta is already p1. | |
@@ -2309,7 +2303,7 class ManifestCtx: | |||||
2309 | valid_bases: Optional[Collection[int]] = None, |
|
2303 | valid_bases: Optional[Collection[int]] = None, | |
2310 | *, |
|
2304 | *, | |
2311 | shallow: bool = False, |
|
2305 | shallow: bool = False, | |
2312 |
) -> Tuple[Optional[int], |
|
2306 | ) -> Tuple[Optional[int], manifestdict]: | |
2313 | """see `imanifestrevisionstored` documentation""" |
|
2307 | """see `imanifestrevisionstored` documentation""" | |
2314 | store = self._storage() |
|
2308 | store = self._storage() | |
2315 | r = store.rev(self._node) |
|
2309 | r = store.rev(self._node) | |
@@ -2330,7 +2324,7 class ManifestCtx: | |||||
2330 | *, |
|
2324 | *, | |
2331 | shallow: bool = False, |
|
2325 | shallow: bool = False, | |
2332 | exact: bool = True, |
|
2326 | exact: bool = True, | |
2333 |
) -> |
|
2327 | ) -> manifestdict: | |
2334 | """see `interface.imanifestrevisionbase` documentations""" |
|
2328 | """see `interface.imanifestrevisionbase` documentations""" | |
2335 | store = self._storage() |
|
2329 | store = self._storage() | |
2336 | r = store.rev(self._node) |
|
2330 | r = store.rev(self._node) | |
@@ -2359,7 +2353,7 class ManifestCtx: | |||||
2359 | md.set(f, new_node, new_flag) |
|
2353 | md.set(f, new_node, new_flag) | |
2360 | return md |
|
2354 | return md | |
2361 |
|
2355 | |||
2362 |
def read_delta_new_entries(self, *, shallow=False) -> |
|
2356 | def read_delta_new_entries(self, *, shallow=False) -> manifestdict: | |
2363 | """see `interface.imanifestrevisionbase` documentations""" |
|
2357 | """see `interface.imanifestrevisionbase` documentations""" | |
2364 | # If we are using narrow, returning a delta against an arbitrary |
|
2358 | # If we are using narrow, returning a delta against an arbitrary | |
2365 | # changeset might return file outside the narrowspec. This can create |
|
2359 | # changeset might return file outside the narrowspec. This can create | |
@@ -2571,7 +2565,7 class TreeManifestCtx: | |||||
2571 | best_base = max(valid_bases) |
|
2565 | best_base = max(valid_bases) | |
2572 | return (None, self._read_storage_slow_delta(base=best_base)) |
|
2566 | return (None, self._read_storage_slow_delta(base=best_base)) | |
2573 |
|
2567 | |||
2574 |
def _read_storage_delta_shallow(self) -> |
|
2568 | def _read_storage_delta_shallow(self) -> manifestdict: | |
2575 | store = self._storage() |
|
2569 | store = self._storage() | |
2576 | r = store.rev(self._node) |
|
2570 | r = store.rev(self._node) | |
2577 | d = mdiff.patchtext(store.revdiff(store.deltaparent(r), r)) |
|
2571 | d = mdiff.patchtext(store.revdiff(store.deltaparent(r), r)) |
General Comments 0
You need to be logged in to leave comments.
Login now