Show More
@@ -1224,6 +1224,21 b' class imanifestrevisionstored(imanifestr' | |||||
1224 |
|
1224 | |||
1225 | The returned object conforms to the ``imanifestdict`` interface.""" |
|
1225 | The returned object conforms to the ``imanifestdict`` interface.""" | |
1226 |
|
1226 | |||
|
1227 | def read_delta_new_entries(*, shallow=False): | |||
|
1228 | """Return a manifest containing just the entries that might be new to | |||
|
1229 | the repository. | |||
|
1230 | ||||
|
1231 | This is often equivalent to a diff against both parents, but without | |||
|
1232 | garantee. For performance reason, It might contains more files in some cases. | |||
|
1233 | ||||
|
1234 | If `shallow` is True, this will read the delta for this directory, | |||
|
1235 | without recursively reading subdirectory manifests. Instead, any | |||
|
1236 | subdirectory entry will be reported as it appears in the manifest, i.e. | |||
|
1237 | the subdirectory will be reported among files and distinguished only by | |||
|
1238 | its 't' flag. This only apply if the underlying manifest support it. | |||
|
1239 | ||||
|
1240 | The returned object conforms to the ``imanifestdict`` interface.""" | |||
|
1241 | ||||
1227 | def readfast(shallow=False): |
|
1242 | def readfast(shallow=False): | |
1228 | """Calls either ``read()`` or ``readdelta()``. |
|
1243 | """Calls either ``read()`` or ``readdelta()``. | |
1229 |
|
1244 | |||
@@ -1477,6 +1492,10 b' class imanifestlog(interfaceutil.Interfa' | |||||
1477 | """nodeconstants used by the current repository.""" |
|
1492 | """nodeconstants used by the current repository.""" | |
1478 | ) |
|
1493 | ) | |
1479 |
|
1494 | |||
|
1495 | narrowed = interfaceutil.Attribute( | |||
|
1496 | """True, is the manifest is narrowed by a matcher""" | |||
|
1497 | ) | |||
|
1498 | ||||
1480 | def __getitem__(node): |
|
1499 | def __getitem__(node): | |
1481 | """Obtain a manifest instance for a given binary node. |
|
1500 | """Obtain a manifest instance for a given binary node. | |
1482 |
|
1501 |
@@ -2090,6 +2090,10 b' class manifestlog:' | |||||
2090 | """ |
|
2090 | """ | |
2091 | return self.get(b'', node) |
|
2091 | return self.get(b'', node) | |
2092 |
|
2092 | |||
|
2093 | @property | |||
|
2094 | def narrowed(self): | |||
|
2095 | return not (self._narrowmatch is None or self._narrowmatch.always()) | |||
|
2096 | ||||
2093 | def get( |
|
2097 | def get( | |
2094 | self, tree: bytes, node: bytes, verify: bool = True |
|
2098 | self, tree: bytes, node: bytes, verify: bool = True | |
2095 | ) -> AnyManifestCtx: |
|
2099 | ) -> AnyManifestCtx: | |
@@ -2317,6 +2321,20 b' class ManifestCtx:' | |||||
2317 | md.set(f, new_node, new_flag) |
|
2321 | md.set(f, new_node, new_flag) | |
2318 | return md |
|
2322 | return md | |
2319 |
|
2323 | |||
|
2324 | def read_delta_new_entries(self, *, shallow=False) -> ManifestDict: | |||
|
2325 | """see `interface.imanifestrevisionbase` documentations""" | |||
|
2326 | # If we are using narrow, returning a delta against an arbitrary | |||
|
2327 | # changeset might return file outside the narrowspec. This can create | |||
|
2328 | # issue when running validation server side with strict security as | |||
|
2329 | # push from low priviledge usage might be seen as adding new revision | |||
|
2330 | # for files they cannot touch. So we are strict if narrow is involved. | |||
|
2331 | if self._manifestlog.narrowed: | |||
|
2332 | return self.read_delta_parents(shallow=shallow, exact=True) | |||
|
2333 | store = self._storage() | |||
|
2334 | r = store.rev(self._node) | |||
|
2335 | d = mdiff.patchtext(store.revdiff(store.deltaparent(r), r)) | |||
|
2336 | return manifestdict(store.nodeconstants.nodelen, d) | |||
|
2337 | ||||
2320 | def find(self, key: bytes) -> Tuple[bytes, bytes]: |
|
2338 | def find(self, key: bytes) -> Tuple[bytes, bytes]: | |
2321 | return self.read().find(key) |
|
2339 | return self.read().find(key) | |
2322 |
|
2340 | |||
@@ -2576,6 +2594,23 b' class TreeManifestCtx:' | |||||
2576 | md.set(f, new_node, new_flag) |
|
2594 | md.set(f, new_node, new_flag) | |
2577 | return md |
|
2595 | return md | |
2578 |
|
2596 | |||
|
2597 | def read_delta_new_entries( | |||
|
2598 | self, *, shallow: bool = False | |||
|
2599 | ) -> AnyManifestDict: | |||
|
2600 | """see `interface.imanifestrevisionbase` documentations""" | |||
|
2601 | # If we are using narrow, returning a delta against an arbitrary | |||
|
2602 | # changeset might return file outside the narrowspec. This can create | |||
|
2603 | # issue when running validation server side with strict security as | |||
|
2604 | # push from low priviledge usage might be seen as adding new revision | |||
|
2605 | # for files they cannot touch. So we are strict if narrow is involved. | |||
|
2606 | if self._manifestlog.narrowed: | |||
|
2607 | return self.read_delta_parents(shallow=shallow, exact=True) | |||
|
2608 | # delegate to existing another existing method for simplicity | |||
|
2609 | store = self._storage() | |||
|
2610 | r = store.rev(self._node) | |||
|
2611 | bases = (store.deltaparent(r),) | |||
|
2612 | return self.read_any_fast_delta(bases, shallow=shallow)[1] | |||
|
2613 | ||||
2579 | def readfast(self, shallow=False) -> AnyManifestDict: |
|
2614 | def readfast(self, shallow=False) -> AnyManifestDict: | |
2580 | """Calls either readdelta or read, based on which would be less work. |
|
2615 | """Calls either readdelta or read, based on which would be less work. | |
2581 | readdelta is called if the delta is against the p1, and therefore can be |
|
2616 | readdelta is called if the delta is against the p1, and therefore can be |
General Comments 0
You need to be logged in to leave comments.
Login now