Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix iter_change_type diff renamed property to prevent warning#1918

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Byron merged 2 commits intogitpython-developers:mainfromkamilkrzyskow:patch-1
Jun 8, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
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
2 changes: 1 addition & 1 deletiongit/diff.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -325,7 +325,7 @@ def iter_change_type(self, change_type: Lit_change_type) -> Iterator[T_Diff]:
yield diffidx
elif change_type == "C" and diffidx.copied_file:
yield diffidx
elif change_type == "R" and diffidx.renamed:
elif change_type == "R" and diffidx.renamed_file:
yield diffidx
elif change_type == "M" and diffidx.a_blob and diffidx.b_blob and diffidx.a_blob != diffidx.b_blob:
yield diffidx
Expand Down
15 changes: 14 additions & 1 deletiontest/deprecation/test_basic.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,7 +31,7 @@
ifTYPE_CHECKING:
frompathlibimportPath

fromgit.diffimportDiff
fromgit.diffimportDiff,DiffIndex
fromgit.objects.commitimportCommit

# ------------------------------------------------------------------------
Expand All@@ -54,6 +54,12 @@ def diff(commit: "Commit") -> Generator["Diff", None, None]:
yielddiff


@pytest.fixture
defdiffs(commit:"Commit")->Generator["DiffIndex",None,None]:
"""Fixture to supply a DiffIndex."""
yieldcommit.diff(NULL_TREE)


deftest_diff_renamed_warns(diff:"Diff")->None:
"""The deprecated Diff.renamed property issues a deprecation warning."""
withpytest.deprecated_call():
Expand DownExpand Up@@ -122,3 +128,10 @@ def test_iterable_obj_inheriting_does_not_warn() -> None:

classDerived(IterableObj):
pass


deftest_diff_iter_change_type(diffs:"DiffIndex")->None:
"""The internal DiffIndex.iter_change_type function issues no deprecation warning."""
withassert_no_deprecation_warning():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

There must have been a misunderstanding. It's not about deprecation warnings, it's about adding a test that fails without the change presented here, while making clear what the issue truly is.

forchange_typeindiffs.change_type:
[*diffs.iter_change_type(change_type=change_type)]
Loading

[8]ページ先頭

©2009-2025 Movatter.jp