FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

`repo.blame` and `repo.blame_incremental` now accept `None` as the `rev` parameter. by Gaubbe · Pull Request #1846 · gitpython-developers/GitPython · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
12 changes: 8 additions & 4 deletions git/repo/base.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -957,13 +957,15 @@ 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
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 @@ -1045,15 +1047,17 @@ 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,
**kwargs: Any,
) -> 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

Back | FazBrowse Home | New Git URL