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
Prev Previous commit
docs: updated explanation of the rev parameter for both blame methods
  • Loading branch information
Gaubbe committed Feb 25, 2024
commit 27d8a14904e0b0932c0d32c2080d647412dcd5e4
8 changes: 6 additions & 2 deletions git/repo/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,9 @@ def blame_incremental(self, rev: str | HEAD | None, file: str, **kwargs: Any) ->
Unlike :meth:`blame`, this does not return the actual file's contents, only a
stream of :class:`BlameEntry` tuples.

:param rev: Revision specifier, see git-rev-parse for viable options.
:param rev: Revision specifier. If `None`, the blame will include all the latest
uncommitted changes. Otherwise, anything succesfully parsed by git-rev-parse
is a valid option.

:return: Lazy iterator of :class:`BlameEntry` tuples, where the commit indicates
the commit to blame for the line, and range indicates a span of line numbers
Expand Down Expand Up @@ -1053,7 +1055,9 @@ def blame(
) -> List[List[Commit | List[str | bytes] | None]] | Iterator[BlameEntry] | None:
"""The blame information for the given file at the given revision.

:param rev: Revision specifier, see git-rev-parse for viable options.
:param rev: Revision specifier. If `None`, the blame will include all the latest
uncommitted changes. Otherwise, anything succesfully parsed by git-rev-parse
is a valid option.

:return:
list: [git.Commit, list: [<line>]]
Expand Down