python-patch
python-patch copied to clipboard
Library to parse and apply unified diffs
Let's see how this one performs.
Hi! I am trying to contribute the behavior for adding/removing files, i.e. managing ``/dev/null``. Most likely this is a poor solution, but please let me know if some other approach...
setup.py
Hi, while [packaging this module for debian](https://bugs.debian.org/845482), we noticed that the `setup.py` file is missing. This file is present in the ZIP from pip, but it would be nice for...
One of the reasons why `patch.py` was started was insecurity of running Unix `patch` utility on web server. In 2015 the Unix patch still has security issues. So it is...
GNU Patch [suffers from vulnerabilities](https://www.cvedetails.com/vulnerability-list/vendor_id-72/product_id-30942/GNU-Patch.html) even in 2019. https://www.cvedetails.com/cve/CVE-2019-13638/ is especially evil. Need to release and package new version of `python-patch` as a safe alternative.
Using the same setup as described in #60: ``` $ ./patch.py --debug working.patch || echo Failed DEBUG reading working.patch DEBUG crlf: 0 lf: 5 cr: 0 - file: b.txt hunk:...
Given the following `a.txt` file: ``` 1 2 3 ``` and the following `working.patch`: ``` --- a.txt 2019-03-28 17:02:04.832004033 -0700 +++ b.txt 2019-03-28 17:02:34.999576803 -0700 @@ -1,4 +1,4 @@ -1...
the opening of the patch file needs a context manager, otherwise if patchset.parse raises an exception, the fp is never closed.
It makes little sense to change the return type of fromfile. Either it's an object (or None if it fails) or it raises an Exception if it fails. Returning an...
PatchSet.apply needs a context manager to restore the prevdir cwd in case of exception. As it is now, the path remains the new root, which may be puzzling.