| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -49,4 +49,5 @@ Contributors are: | |||
| 49 | 49 | -Julien Mauroy <pro.julien.mauroy _at_ gmail.com> | |
| 50 | 50 | -Patrick Gerard | |
| 51 | 51 | -Luke Twist <itsluketwist@gmail.com> | |
| 52 | + -Joseph Hale <me _at_ jhale.dev> | ||
| 52 | 53 | Portions derived from other open source works and are clearly marked. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -950,7 +950,12 @@ def blame_incremental(self, rev: str | HEAD, file: str, **kwargs: Any) -> Iterat | |||
| 950 | 950 | ) | |
| 951 | 951 | ||
| 952 | 952 | def blame( | |
| 953 | - self, rev: Union[str, HEAD], file: str, incremental: bool = False, **kwargs: Any | ||
| 953 | + self, | ||
| 954 | + rev: Union[str, HEAD], | ||
| 955 | + file: str, | ||
| 956 | + incremental: bool = False, | ||
| 957 | + rev_opts: Optional[List[str]] = None, | ||
| 958 | + **kwargs: Any | ||
| 954 | 959 | ) -> List[List[Commit | List[str | bytes] | None]] | Iterator[BlameEntry] | None: | |
| 955 | 960 | """The blame information for the given file at the given revision. | |
| 956 | 961 | ||
@@ -962,8 +967,8 @@ def blame( | |||
| 962 | 967 | of appearance.""" | |
| 963 | 968 | if incremental: | |
| 964 | 969 | return self.blame_incremental(rev, file, **kwargs) | |
| 965 | - | ||
| 966 | - data: bytes = self.git.blame(rev, "--", file, p=True, stdout_as_string=False, **kwargs) | ||
| 970 | + rev_opts = rev_opts or [] | ||
| 971 | + data: bytes = self.git.blame(rev, *rev_opts, "--", file, p=True, stdout_as_string=False, **kwargs) | ||
| 967 | 972 | commits: Dict[str, Commit] = {} | |
| 968 | 973 | blames: List[List[Commit | List[str | bytes] | None]] = [] | |
| 969 | 974 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -553,6 +553,13 @@ def test_blame_complex_revision(self, git): | |||
| 553 | 553 | self.assertEqual(len(res), 1) | |
| 554 | 554 | self.assertEqual(len(res[0][1]), 83, "Unexpected amount of parsed blame lines") | |
| 555 | 555 | ||
| 556 | + @mock.patch.object(Git, "_call_process") | ||
| 557 | + def test_blame_accepts_rev_opts(self, git): | ||
| 558 | + res = self.rorepo.blame("HEAD", "README.md", rev_opts=["-M", "-C", "-C"]) | ||
| 559 | + expected_args = ['blame', 'HEAD', '-M', '-C', '-C', '--', 'README.md'] | ||
| 560 | + boilerplate_kwargs = {"p" : True, "stdout_as_string": False} | ||
| 561 | + git.assert_called_once_with(*expected_args, **boilerplate_kwargs) | ||
| 562 | + | ||
| 556 | 563 | @skipIf( | |
| 557 | 564 | HIDE_WINDOWS_KNOWN_ERRORS and Git.is_cygwin(), | |
| 558 | 565 | """FIXME: File "C:\\projects\\gitpython\\git\\cmd.py", line 671, in execute | |
| Back | FazBrowse Home | New Git URL |
0 commit comments