How do I apply patches from Trac?

Hi,

although I found some posts about applying patches in this group, I
did not come along with this.

I want to apply this patch: http://dev.rubyonrails.org/ticket/10059

How do I apply patches in general? I read something about diff-files,
git, patch, frozen ruby, etc., but I don’t understand the procedure. I
would be very pleased, if you could help me.

Thank you alot!
ms

On 10 Nov 2008, at 17:07, ms wrote:

would be very pleased, if you could help me.

Well for starters it’s probably a good idea to have rails frozen in
your app’s vendor/rails.
The patch file is just a diff between the original and the new version
(ie a list of changes to make).
Typically you download the diff file from trac (if there is more than
one attachment you’ll just have to figure out whether one of the
supersedes all others)

if you cd to vendor/rails you can then do something like

patch -p0 < path/to/patch.diff

A long time ago i also coded up a quick hack to make this a little
easier. The gem file is at
https://svn1.hosted-projects.com/fcheung/apply_ticket/ApplyTicket-0.1.0.gem
Once you’ve got that installed you can just do (having cd’d to the
copy of rails you want to patch)
apply_ticket 10059

and it will do all the above for you (in the case that there are
multiple attachments available it will ask you which one you want).

Someone released some rake tasks that do the same for lighthouse but I
can’t remember who/where they are.

Fred