(name_status_lines: Iterable[str], patch_lines: Iterable[str])
| 276 | |
| 277 | |
| 278 | def 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 | |
| 304 | def normalize_pr_files_payload(payload: object) -> list[dict[str, object]]: |
no test coverage detected