After having proposed a modification to python.org on the cmd.py lib in order to manage correctly, I have been asked for sending the associated patch… Of course, I will!.. But before, I need to learn how to make a patch. Here is the way to do it:
Let’s imagine I have my old.py file that has a bug, and the new.py that is the old.py with the bug correction. to generate the patch, do:
diff -ruN old.py new.py >mypatch -r is to do it recursively. In how case, not really useful, but you can create patch on directories. -u will output 3 lines of unified context. Default is 3. -U4 will put 4 lines... -N will be used to treat absent files as empty files. Same, in our case not useful, but usefull for patches on directories.
Now, how to apply a patch:
patch < mypatch for a file. patch -pNUM < mypatch #where NUM is the recursive depth for directories
Here it is…
Let me know, if this helped!
That’s it, you have made a patch.
How to use it