From f2e35e775c4346011b59bdbdb3d78cf388305ff3 Mon Sep 17 00:00:00 2001 From: Gaubbe Date: Sat, 24 Feb 2024 15:58:35 -0500 Subject: [PATCH 1/2] fix: both blame methods accept None as a revision --- git/repo/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git/repo/base.py b/git/repo/base.py index f5069dbf5..24f140f62 100644 --- a/git/repo/base.py +++ b/git/repo/base.py @@ -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 @@ -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, From 27d8a14904e0b0932c0d32c2080d647412dcd5e4 Mon Sep 17 00:00:00 2001 From: Gaubbe Date: Sun, 25 Feb 2024 17:58:38 -0500 Subject: [PATCH 2/2] docs: updated explanation of the `rev` parameter for both blame methods --- git/repo/base.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/git/repo/base.py b/git/repo/base.py index 24f140f62..bf7c2cc0d 100644 --- a/git/repo/base.py +++ b/git/repo/base.py @@ -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 @@ -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: []] pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy