MCPcopy Create free account
hub / github.com/PostHog/duckgres / analyze_diff

Function analyze_diff

scripts/test_impact_plan.py:278–301  ·  view source on GitHub ↗
(name_status_lines: Iterable[str], patch_lines: Iterable[str])

Source from the content-addressed store, hash-verified

276
277
278def analyze_diff(name_status_lines: Iterable[str], patch_lines: Iterable[str]) -> TestImpactPlan:
279 plan = TestImpactPlan()
280
281 for line in name_status_lines:
282 parsed = parse_name_status(line)
283 if parsed is None:
284 continue
285 status, path, previous_path = parsed
286 if status == "R" and previous_path:
287 add_rename_delta(plan, previous_path, path)
288 else:
289 add_file_delta(plan, status, path)
290
291 current_path = ""
292 for line in patch_lines:
293 if line.startswith("diff --git "):
294 parts = line.split()
295 if len(parts) >= 4:
296 current_path = parts[3][2:] if parts[3].startswith("b/") else parts[3]
297 continue
298 analyze_patch_line(plan, current_path, line)
299
300 add_warnings(plan)
301 return plan
302
303
304def normalize_pr_files_payload(payload: object) -> list[dict[str, object]]:

Callers 1

mainFunction · 0.85

Calls 6

TestImpactPlanClass · 0.85
parse_name_statusFunction · 0.85
add_rename_deltaFunction · 0.85
add_file_deltaFunction · 0.85
analyze_patch_lineFunction · 0.85
add_warningsFunction · 0.85

Tested by

no test coverage detected