MCPcopy Create free account
hub / github.com/acking-you/static_flow / _lock_reverse_reachable

Function _lock_reverse_reachable

scripts/ci_affected.py:200–230  ·  view source on GitHub ↗

All package ids that transitively depend on any id in `start_ids` (inclusive), following the lock graph in reverse. Lock dependency strings are `name`, `name version`, or `name version (source)` -- the longer forms appear only when the short ones would be ambiguous, so matching on t

(deps, start_ids)

Source from the content-addressed store, hash-verified

198
199def root_manifest_change_is_workspace_members_only(base, head):
200 mb = run(["git", "merge-base", base, head])
201 old_rev = mb.stdout.strip() if mb.returncode == 0 and mb.stdout.strip() else base
202 old_manifest = _toml_at(old_rev, ROOT_MANIFEST)
203 new_manifest = _toml_at(head, ROOT_MANIFEST)
204 if old_manifest is None or new_manifest is None:
205 return False
206 return _without_workspace_members(old_manifest) == _without_workspace_members(new_manifest)
207
208
209def owning_crate(f, dir2name):
210 best = None
211 for d in dir2name:
212 if f == d or f.startswith(d + "/"):
213 if best is None or len(d) > len(best):
214 best = d
215 return dir2name[best] if best else None
216
217
218def _lock_packages(rev):
219 """Parse Cargo.lock at `rev`.
220
221 Returns (format_version, {id: fingerprint}, {id: deps_tuple}) where
222 id = (name, version, source-or-None), or None when the lock cannot be
223 read/parsed at that revision.
224 """
225 res = run(["git", "show", f"{rev}:Cargo.lock"])
226 if res.returncode != 0:
227 return None
228 try:
229 lock = tomllib.loads(res.stdout)
230 except tomllib.TOMLDecodeError:
231 return None
232 fingerprints, deps = {}, {}
233 for p in lock.get("package", []):

Callers 1

lock_affected_membersFunction · 0.85

Calls 2

appendMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected