Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to apply django patches

Tags:

django

I want to apply a patch to this bug (http://code.djangoproject.com/ticket/13095) but I have never done it before and I have no idea where to begin. Can anyone point me to a tutorial?

like image 406
iJK Avatar asked Jul 25 '10 23:07

iJK


1 Answers

On Linux/UNIX, you can use the patch command for this.

It works in the following way:

cd /usr/lib.../site-packages/django/
patch --dry-run -p1 < ~/downloads/somefix.patch

The patch command looks in the file to find the proper files it needs to update. The -p1 tells patch to ignore the first level of the folder mentioned in the patch file. Often this is the project name itself. The --dry-run option prevents actual execution, so you can experiment with it.

When everything is allright, you can remove the --dry-run option, and the actual patch will be applied.


On Windows, several tools (e.g. WinMerge / TortoiseMerge) have a "Apply patch" option in the menu, which will allow you to do the same thing.

like image 147
vdboor Avatar answered Oct 14 '22 08:10

vdboor