Generate unified diff between old and new content.
(self, filename: str, old_lines: List[str], new_lines: List[str])
| 412 | raise FilesystemAccessError(f"Failed to list {path}: {e}") |
| 413 | |
| 414 | def _generate_diff(self, filename: str, old_lines: List[str], new_lines: List[str]) -> str: |
| 415 | """Generate unified diff between old and new content.""" |
| 416 | diff = difflib.unified_diff( |
| 417 | old_lines, |
| 418 | new_lines, |
| 419 | fromfile=f"a/{filename}", |
| 420 | tofile=f"b/{filename}", |
| 421 | n=3 |
| 422 | ) |
| 423 | return ''.join(diff) |
| 424 | |
| 425 | def get_last_diff(self) -> Optional[str]: |
| 426 | """Get the diff from the last patch operation.""" |