Fix iter_change_type diff renamed property to prevent warning #1918
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Hello 👋,
in #1886 and e7dec7d a proper warning message was introduced for the usage of
Diff.renamed
pointing to useDiff.renamed_file
.However, the usage of this property wasn't changed in the
iter_change_type
(since 3 years at that), so the internals use deprecated code 😞GitPython/git/diff.py
Lines 328 to 329 in 9fbfb71
Given that the code wasn't reported yet, perhaps I'm doing something wrong using the
iter_change_type
and there are better ways 👀 I'm using a custom MkDocs hook to run GitPython and check for renames to automatically create redirects mappings for paths, and another plugin handles the redirect creation for the static pages.Here is the line which triggered the warning
And the CI:
Warning
As this is a one line change, I took the liberty to omit setting up an environment and just used the GitHub GUI to make a small change.
I also didn't investigate deeper to check if the
iter_change_type
has any tests.Thanks for your time ✌️