Merge pull request #1485 from thehale/blame/rev-opts · gitpython-developers/GitPython@bec6157 · GitHub
Skip to content

Commit bec6157

Browse files
authored
Merge pull request #1485 from thehale/blame/rev-opts
feat(blame): Support custom `rev_opts` for blame
2 parents 73bde1f + 18a79d8 commit bec6157

3 files changed

Lines changed: 16 additions & 3 deletions

File tree

AUTHORS

Lines changed: 1 addition & 0 deletions

git/repo/base.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,12 @@ def blame_incremental(self, rev: str | HEAD, file: str, **kwargs: Any) -> Iterat
950950
)
951951

952952
def blame(
953-
self, rev: Union[str, HEAD], file: str, incremental: bool = False, **kwargs: Any
953+
self,
954+
rev: Union[str, HEAD],
955+
file: str,
956+
incremental: bool = False,
957+
rev_opts: Optional[List[str]] = None,
958+
**kwargs: Any
954959
) -> List[List[Commit | List[str | bytes] | None]] | Iterator[BlameEntry] | None:
955960
"""The blame information for the given file at the given revision.
956961
@@ -962,8 +967,8 @@ def blame(
962967
of appearance."""
963968
if incremental:
964969
return self.blame_incremental(rev, file, **kwargs)
965-
966-
data: bytes = self.git.blame(rev, "--", file, p=True, stdout_as_string=False, **kwargs)
970+
rev_opts = rev_opts or []
971+
data: bytes = self.git.blame(rev, *rev_opts, "--", file, p=True, stdout_as_string=False, **kwargs)
967972
commits: Dict[str, Commit] = {}
968973
blames: List[List[Commit | List[str | bytes] | None]] = []
969974

test/test_repo.py

Lines changed: 7 additions & 0 deletions

0 commit comments

Comments
 (0)