my new favourite one liner

Well last weeks bug hunt went well by all accounts we managed to convince Ryan to make 30 commits and about 100 tickets were closed. During the process of testing all these patches I found a new favourite one-liner for working with trac and patches:

svn revert -R * && curl "trac-patch-raw-fileurl" | patch -p0

This enables you to download a patch direct from the trac web interface and apply it against your local svn checkout ensuring to revert any other local changes first. For example using this with the patch attached to ticket 3110:

svn revert -R * && curl "http://trac.wordpress.org/attachment/ticket/3110/3110.diff?format=raw" | patch -p0

2 thoughts on “my new favourite one liner

  1. I had a good time. Thank you for being a welcoming part of my 1st WordPress bug hunt.

    That is a great tip. Looks like the makings of a very useful bash function! Nit: I would probably make the 1st part “svn revert -R .”

  2. Indeed Lloyd your right I don’t need the * there.

    I’ve now added the following to my .bashrc so that I can just copy the patch urls straight from the ticket page and not have to remember to collect the raw file url:


    trac-patch() {
    svn revert -R . && curl "$1?format=raw" | patch -p0
    }

Comments are closed.