Represents a single change block in a patch.
| 34 | |
| 35 | |
| 36 | class PatchHunk: |
| 37 | """Represents a single change block in a patch.""" |
| 38 | |
| 39 | def __init__(self): |
| 40 | self.operation: str = "Update" # Update, Add, Delete |
| 41 | self.filepath: str = "" |
| 42 | self.search_hint: str = "" # Text from @@ line |
| 43 | self.context_before: List[str] = [] |
| 44 | self.old_lines: List[str] = [] |
| 45 | self.new_lines: List[str] = [] |
| 46 | self.context_after: List[str] = [] |
| 47 | |
| 48 | def __repr__(self): |
| 49 | return f"PatchHunk(op={self.operation}, file={self.filepath}, old={len(self.old_lines)}, new={len(self.new_lines)})" |
| 50 | |
| 51 | |
| 52 | class MatchResult: |