Wednesday, November 19, 2008

svn and tons of ignores

I never realized what a pain it was to maintain svn:ignore properties until I started using git (which makes it really easy to collect cruft metadata after a build).

After some searching on the web, I found this script:

# svn-ignore - tell Subversion to ignore a file in certain operations.

# See: []

test -z "$1" && echo "Usage: $0 FILENAME" && exit -1

for fullname in "$@"


dirname=$(dirname "$fullname")

filename=$(basename "$fullname")

(svn propget svn:ignore "$dirname" | egrep -v '^$';

echo "$filename") >/tmp/svn-ignore.$$

svn propset svn:ignore -F /tmp/svn-ignore.$$ "$dirname"

rm /tmp/svn-ignore.$$


That coupled with:

for i in `svn status` ; do if [ $i != "?" ]; then echo $i ; svn-ignore $i ; fi ; done

really saved me a lot of work.