As I sit here blaming code to find the original source of a line of code I’m beginning to think that
svn needs a new improved version of
spelunk it would work something like this:
$ svn help spelunk
spelunk (curse, showup, show): Output the content of specified files or URLs with the original revision and author information in-line ignoring white space changes and following movement of code between files.
Yes – I know I am dreaming
In order to answer a plea for help from a commandline phobe for an easy to use subversion client for OS X I went searching for a TortoiseSVN equivalent. Tortoise is the subversion client for Windows so I hoped that someone would have developed something similar to integrate with Finder. After a little bit of searching I found scplugin and recommended it. I finally got a chance to try it out myself this evening and so far it looks really good.
A long time ago I wrote about the ways in which you can get involved in WordPress development using free available tools on windows in my post “Windows WordPress toolbox”. Since that post I have come up with a number of useful scripts and shortcuts that I use in my WordPress development.
Here are a number tools that I use most often, these are a set of bash functions which you can stick in your ~/.bashrc file on your linux machine or mac :
//Download a patch from a trac install and apply it to a svn checkout
//e.g. wp-trac-patch http://trac.wordpress.org/attachment/ticket/2345/2345.diff
svn revert -R . & curl "$1?format=raw" | patch -p0
//Search through a subversion checkout using grep (only search the .php and .js files)
//e.g. wp-grep the_excerpt
find . \( -name "*.php" -print , -name "*.js" -print \) | xargs grep "$1"
//Merge a change from trunk to a branch in a subversion checkout of the whole repository
//e.g. wp-merge 1234 2.6
svn merge -r $(($1-1)):$1 trunk branches/$2
//Output the svn:eol-style property of all the files in a repository
find . \( -name "*.php" -print , -name "*.js" -print \) | xargs svn propget svn:eolstyle
I hope you find this useful
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