feat(blame): Support custom `rev_opts` for blame by thehale · Pull Request #1485 · gitpython-developers/GitPython · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
11 changes: 8 additions & 3 deletions git/repo/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,12 @@ def blame_incremental(self, rev: str | HEAD, file: str, **kwargs: Any) -> Iterat
)

def blame(
self, rev: Union[str, HEAD], file: str, incremental: bool = False, **kwargs: Any
self,
rev: Union[str, HEAD],
file: str,
incremental: bool = False,
rev_opts: Optional[List[str]] = None,
**kwargs: Any
) -> List[List[Commit | List[str | bytes] | None]] | Iterator[BlameEntry] | None:
"""The blame information for the given file at the given revision.

Expand All @@ -962,8 +967,8 @@ def blame(
of appearance."""
if incremental:
return self.blame_incremental(rev, file, **kwargs)

data: bytes = self.git.blame(rev, "--", file, p=True, stdout_as_string=False, **kwargs)
rev_opts = rev_opts or []
data: bytes = self.git.blame(rev, *rev_opts, "--", file, p=True, stdout_as_string=False, **kwargs)
commits: Dict[str, Commit] = {}
blames: List[List[Commit | List[str | bytes] | None]] = []

Expand Down
7 changes: 7 additions & 0 deletions test/test_repo.py