| 148 | # See https://git-scm.com/docs/git-diff#_raw_output_format |
| 149 | @dataclass |
| 150 | class RawDiffLine: |
| 151 | src_mode: str |
| 152 | """e.g. 100644; 000000 for creation/unmerged""" |
| 153 | dst_mode: str |
| 154 | src_sha: str |
| 155 | """sha1 or 0 if creation/unmerged""" |
| 156 | dst_sha: str |
| 157 | status: str |
| 158 | """A, C (copy), D, M, R, T (change in type), U (unmerged), X (bug)""" |
| 159 | path: str |
| 160 | score: Union[int, None] = None |
| 161 | """Only for R or C""" |
| 162 | dst_path: Union[str, None] = None |
| 163 | """Only set when status=C or R.""" |
| 164 | num_add: Union[int, None] = None |
| 165 | """Num added lines from diffstat. None for binary files.""" |
| 166 | num_delete: Union[int, None] = None |
| 167 | """Num removed lines from diffstat. None for binary files.""" |
| 168 | |
| 169 | |
| 170 | def parse_raw_diff_line(parts: list[str]) -> RawDiffLine: |
no outgoing calls