GeezerVison is showing github.com — Deprecate Commit.trailers. · gitpython-developers/GitPython@78424b5
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: git/objects/commit.py -18Lines changed: 0 additions & 18 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -335,24 +335,6 @@ def stats(self) -> Stats: |
335 | 335 | text = self.repo.git.diff(self.parents[0].hexsha, self.hexsha, "--", numstat=True, no_renames=True) |
336 | 336 | return Stats._list_from_string(self.repo, text) |
337 | 337 |
|
338 | | - @property |
339 | | - def trailers(self) -> Dict[str, str]: |
340 | | - """Get the trailers of the message as a dictionary |
341 | | -
|
342 | | - Git messages can contain trailer information that are similar to RFC 822 |
343 | | - e-mail headers (see: https://git-scm.com/docs/git-interpret-trailers). |
344 | | -
|
345 | | - WARNING: This function only returns the latest instance of each trailer key |
346 | | - and will be deprecated soon. Please see either ``Commit.trailers_list`` or ``Commit.trailers_dict``. |
347 | | -
|
348 | | - :return: |
349 | | - Dictionary containing whitespace stripped trailer information. |
350 | | - Only the latest instance of each trailer key. |
351 | | - """ |
352 | | - return { |
353 | | - k: v[0] for k, v in self.trailers_dict.items() |
354 | | - } |
355 | | - |
356 | 338 | @property |
357 | 339 | def trailers_list(self) -> List[str]: |
358 | 340 | """Get the trailers of the message as a list |
|
Collapse file
Copy file name to clipboardExpand all lines: test/test_commit.py -6Lines changed: 0 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -523,10 +523,6 @@ def test_trailers(self): |
523 | 523 | KEY_1: [VALUE_1_1, VALUE_1_2], |
524 | 524 | KEY_2: [VALUE_2], |
525 | 525 | } |
526 | | - assert commit.trailers == { |
527 | | - KEY_1: VALUE_1_1, |
528 | | - KEY_2: VALUE_2, |
529 | | - } |
530 | 526 |
|
531 | 527 | # check that trailer stays empty for multiple msg combinations |
532 | 528 | msgs = [ |
@@ -543,14 +539,12 @@ def test_trailers(self): |
543 | 539 | commit.message = msg |
544 | 540 | assert commit.trailers_list == [] |
545 | 541 | assert commit.trailers_dict == {} |
546 | | - assert commit.trailers == {} |
547 | 542 |
|
548 | 543 | # check that only the last key value paragraph is evaluated |
549 | 544 | commit = copy.copy(self.rorepo.commit("master")) |
550 | 545 | commit.message = f"Subject\n\nMultiline\nBody\n\n{KEY_1}: {VALUE_1_1}\n\n{KEY_2}: {VALUE_2}\n" |
551 | 546 | assert commit.trailers_list == [f"{KEY_2}: {VALUE_2}"] |
552 | 547 | assert commit.trailers_dict == {KEY_2: [VALUE_2]} |
553 | | - assert commit.trailers == {KEY_2: VALUE_2} |
554 | 548 |
|
555 | 549 | def test_commit_co_authors(self): |
556 | 550 | commit = copy.copy(self.rorepo.commit("4251bd5")) |
|