mercurial/manifest.py
changeset 51781 bcb825bf0c5e
parent 51777 a891347058e7
child 51784 9af1acc1ffab
equal deleted inserted replaced
51780:9844bab33aee 51781:bcb825bf0c5e
  2088         """Retrieves the manifest instance for the given node. Throws a
  2088         """Retrieves the manifest instance for the given node. Throws a
  2089         LookupError if not found.
  2089         LookupError if not found.
  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:
  2096         """Retrieves the manifest instance for the given node. Throws a
  2100         """Retrieves the manifest instance for the given node. Throws a
  2097         LookupError if not found.
  2101         LookupError if not found.
  2314                 if f not in d2:
  2318                 if f not in d2:
  2315                     continue
  2319                     continue
  2316                 if new_node is not None:
  2320                 if new_node is not None:
  2317                     md.set(f, new_node, new_flag)
  2321                     md.set(f, new_node, new_flag)
  2318             return md
  2322             return md
       
  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)
  2319 
  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 
  2323 
  2341 
  2574                         continue
  2592                         continue
  2575                     if new_node is not None:
  2593                     if new_node is not None:
  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
  2582         read quickly.
  2617         read quickly.
  2583 
  2618