Parse a ``*** Add/Delete/Update File:`` header line.
(
lines: List[str], idx: int,
)
| 538 | return idx |
| 539 | |
| 540 | def _parse_patch_header( |
| 541 | lines: List[str], idx: int, |
| 542 | ) -> Optional[Tuple[str, Optional[str], int]]: |
| 543 | """Parse a ``*** Add/Delete/Update File:`` header line.""" |
| 544 | line = lines[idx] |
| 545 | |
| 546 | if line.startswith("*** Add File:"): |
| 547 | file_path = line.split(":", 1)[1].strip() |
| 548 | return (file_path, None, idx + 1) if file_path else None |
| 549 | |
| 550 | if line.startswith("*** Delete File:"): |
| 551 | file_path = line.split(":", 1)[1].strip() |
| 552 | return (file_path, None, idx + 1) if file_path else None |
| 553 | |
| 554 | if line.startswith("*** Update File:"): |
| 555 | file_path = line.split(":", 1)[1].strip() |
| 556 | if not file_path: |
| 557 | return None |
| 558 | move_path: Optional[str] = None |
| 559 | next_idx = idx + 1 |
| 560 | if next_idx < len(lines) and lines[next_idx].startswith("*** Move to:"): |
| 561 | move_path = lines[next_idx].split(":", 1)[1].strip() |
| 562 | next_idx += 1 |
| 563 | return (file_path, move_path, next_idx) |
| 564 | |
| 565 | return None |
| 566 | |
| 567 | def _parse_add_file_content( |
| 568 | lines: List[str], start_idx: int, |