OpenLayers 2 is outdated. Go to the latest 3.x version: http://openlayers.org/
How to Apply a Patch
If you have a patch that you wish to be apply to your local svn copy of the OpenLayers repository, all you need to do is put the patch file the root of your openlayers directory and call:
patch -p0 < myPatch.patch
There's a chance that the patch you're trying to apply starts from an absolute path reference coder's development machine. The patch command accommodates this situation by trimming leading patch segments from the file references using the -p0 to -p6 options where the number indicates how many path segments to trim. See more details at http://linux.die.net/man/1/patch
Patches can be downloaded from trac by clicking the "Original Format" link at the bottom of any trac patch attachment.
For instructions on how to create a patch, see CreatingPatches