Skip to content

repo.blame and repo.blame_incremental now accept None as the rev parameter. #1846

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 26, 2024
Merged
Changes from 1 commit
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
Next Next commit
fix: both blame methods accept None as a revision
  • Loading branch information
Gaubbe committed Feb 24, 2024
commit f2e35e775c4346011b59bdbdb3d78cf388305ff3
4 changes: 2 additions & 2 deletions git/repo/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ def active_branch(self) -> Head:
# reveal_type(self.head.reference) # => Reference
return self.head.reference

def blame_incremental(self, rev: str | HEAD, file: str, **kwargs: Any) -> Iterator["BlameEntry"]:
def blame_incremental(self, rev: str | HEAD | None, file: str, **kwargs: Any) -> Iterator["BlameEntry"]:
"""Iterator for blame information for the given file at the given revision.

Unlike :meth:`blame`, this does not return the actual file's contents, only a
Expand Down Expand Up @@ -1045,7 +1045,7 @@ def blame_incremental(self, rev: str | HEAD, file: str, **kwargs: Any) -> Iterat

def blame(
self,
rev: Union[str, HEAD],
rev: Union[str, HEAD, None],
file: str,
incremental: bool = False,
rev_opts: Optional[List[str]] = None,
Expand Down