| 50 | |
| 51 | |
| 52 | class BlameHunk: |
| 53 | _blame: 'Blame' |
| 54 | _hunk: 'GitHunkC' |
| 55 | |
| 56 | @classmethod |
| 57 | def _from_c(cls, blame: 'Blame', ptr: 'GitHunkC') -> 'BlameHunk': |
| 58 | hunk = cls.__new__(cls) |
| 59 | hunk._blame = blame |
| 60 | hunk._hunk = ptr |
| 61 | return hunk |
| 62 | |
| 63 | @property |
| 64 | def lines_in_hunk(self) -> int: |
| 65 | """Number of lines""" |
| 66 | return self._hunk.lines_in_hunk |
| 67 | |
| 68 | @property |
| 69 | def boundary(self) -> bool: |
| 70 | """Tracked to a boundary commit""" |
| 71 | # Casting directly to bool via cffi does not seem to work |
| 72 | return int(ffi.cast('int', self._hunk.boundary)) != 0 |
| 73 | |
| 74 | @property |
| 75 | def final_start_line_number(self) -> int: |
| 76 | """Final start line number""" |
| 77 | return self._hunk.final_start_line_number |
| 78 | |
| 79 | @property |
| 80 | def final_committer(self) -> None | Signature: |
| 81 | """Final committer""" |
| 82 | return wrap_signature(self._hunk.final_signature) |
| 83 | |
| 84 | @property |
| 85 | def final_commit_id(self) -> Oid: |
| 86 | return Oid( |
| 87 | raw=bytes(ffi.buffer(ffi.addressof(self._hunk, 'final_commit_id'))[:]) |
| 88 | ) |
| 89 | |
| 90 | @property |
| 91 | def orig_start_line_number(self) -> int: |
| 92 | """Origin start line number""" |
| 93 | return self._hunk.orig_start_line_number |
| 94 | |
| 95 | @property |
| 96 | def orig_committer(self) -> None | Signature: |
| 97 | """Original committer""" |
| 98 | return wrap_signature(self._hunk.orig_signature) |
| 99 | |
| 100 | @property |
| 101 | def orig_commit_id(self) -> Oid: |
| 102 | return Oid( |
| 103 | raw=bytes(ffi.buffer(ffi.addressof(self._hunk, 'orig_commit_id'))[:]) |
| 104 | ) |
| 105 | |
| 106 | @property |
| 107 | def orig_path(self) -> None | str: |
| 108 | """Original path""" |
| 109 | path = self._hunk.orig_path |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…