We’ve all been there, you’re working on a project with lots of externals and we see a lot of noise when you run svn status or svn st (depending on your preference). Most of the time we just filter that out, but I decided to string a few grep statements together to make the output that little bit nicer to read.
So to start with here is a typical svn status on one of my projects
# svn st X lib X data ? batch X config/doctrine Performing status on external item at 'data' ? data/sql Performing status on external item at 'config/doctrine' Performing status on external item at 'lib'
Now you could filter out all of the empty lines with grep -i [a-z0-9] which makes the output
# svn st | grep -i [a-z0-9] X lib X data ? batch X config/doctrine Performing status on external item at 'data' ? data/sql Performing status on external item at 'config/doctrine' Performing status on external item at 'lib'
Now this is an improvement, but there is still too much noise for my liking so I then filter out all of the “Performing status on external …” lines and those which start with “X” with another grep statement.
# svn st | grep -i [a-z0-9] | egrep -v ^"Perform|X" ? batch ? data/sql
Now this is all well and good, but you will probably want to run this on a regular basis when working on your project so you can put this into a bash file in your local bin directory (e.g. /home/carl/bin).
# echo 'svn st | grep -i $@ [a-z0-9] | egrep -v ^"Perform|X"' > /home/carl/bin/st # chmod +x /home/carl/bin/st
You’ll notice that the above command has been changed slightly to include $@. This is to allow you to pass file/folder path(s) into the script to restrict subdirectories from the directory you run the script in.
When run on it’s own:
# st ? batch ? data/sql
When given a folder name:
# st data ? data/sql