-
-
Notifications
You must be signed in to change notification settings - Fork 399
Deprecate Patch.patch and add Patch.text and Patch.data #893
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This is an attempt to finish up the work in PR #790 originally done by @erikvanzijst. Thanks to him for the initial work. Patch.patch assumes all content to be encoded in UTF-8 and forcefully replaces any non-decodeable sequences. This can lead to corruption for content that either does not conform to any specific encoding altogether, or uses an encoding that is incompatible with, or ambiguous to UTF-8. As discussed in #790, this change deprecates Patch.patch in favor of Patch.text and adds Patch.data, which returns the unmodified, raw bytes.
I'd argue this is not deprecating, it's purely replacing. Deprecating implies there is a warning and no API breakage (yet). |
You could keep |
@pypingou That's exactly what I already did. |
Oh, I see it now, sorry about that I had misread the diff initially :( |
0.28.1 (2019-04-19) ------------------------- - Now works with pycparser 2.18 and above `#846 <https://github.com/libgit2/pygit2/issues/846>`_ - Now ``Repository.write_archive(..)`` keeps the file mode `#616 <https://github.com/libgit2/pygit2/issues/616>`_ `#898 <https://github.com/libgit2/pygit2/pull/898>`_ - New ``Patch.data`` returns the raw contents of the patch as a byte string `#790 <https://github.com/libgit2/pygit2/pull/790>`_ `#893 <https://github.com/libgit2/pygit2/pull/893>`_ - New ``Patch.text`` returns the contents of the patch as a text string, deprecates `Patch.patch` `#790 <https://github.com/libgit2/pygit2/pull/790>`_ `#893 <https://github.com/libgit2/pygit2/pull/893>`_ Deprecations: - ``Patch.patch`` is deprecated, use ``Patch.text`` instead
0.28.1 (2019-04-19) ------------------------- - Now works with pycparser 2.18 and above `#846 <https://github.com/libgit2/pygit2/issues/846>`_ - Now ``Repository.write_archive(..)`` keeps the file mode `#616 <https://github.com/libgit2/pygit2/issues/616>`_ `#898 <https://github.com/libgit2/pygit2/pull/898>`_ - New ``Patch.data`` returns the raw contents of the patch as a byte string `#790 <https://github.com/libgit2/pygit2/pull/790>`_ `#893 <https://github.com/libgit2/pygit2/pull/893>`_ - New ``Patch.text`` returns the contents of the patch as a text string, deprecates `Patch.patch` `#790 <https://github.com/libgit2/pygit2/pull/790>`_ `#893 <https://github.com/libgit2/pygit2/pull/893>`_ Deprecations: - ``Patch.patch`` is deprecated, use ``Patch.text`` instead
This is an attempt to finish up the work in PR #790 originally done by @erikvanzijst. Thanks to him for the initial work.
Patch.patch
assumes all content to be encoded in UTF-8 and forcefully replaces any non-decodeable sequences. This can lead to corruption for content that either does not conform to any specific encoding altogether, or uses an encoding that is incompatible with, or ambiguous to UTF-8.As discussed in #790, this change deprecates
Patch.patch
in favor ofPatch.text
and addsPatch.data
, which returns the unmodified, raw bytes.