Thursday, July 26, 2007

Small script for ignoring files in Subversion

Subversion takes a slightly different, and more general approach to ignoring files and directories. Unlike the .cvsignore with CVS, SVN uses its property mechanism. I just wrote a small script to help me add ignores:

#!/bin/bash

TMPFILE=.newcvsignore

rm -f ${TMPFILE}

# add whatever already is ignored
for i in `svn propget svn:ignore`; do
echo "Adding $i"
echo $i >> ${TMPFILE}
done

# add new things to ignore
for i in $*; do
echo "Adding $i"
echo $i >> ${TMPFILE}
done

svn propset svn:ignore -F ${TMPFILE} .

rm -f ${TMPFILE}

There might be an easier trick to do this, but now at least I have this nice one-liner:

svnignore somefile

4 comments:

Anonymous said...

Something like this, and many many more cool scripts can also be found in KDE svn under this dir (in svn) ssh://svn.kde.org/home/kde/trunk/KDE/kdesdk/scripts

Cheers!

ThomasZ

Unknown said...

why not svn propedit?

Unknown said...

More SVN tricks + scripts here:

http://www.easysw.com/~mike/svn-cheat.html

Egon Willighagen said...

Pier, great tip on svn propedit! Stupid of me to have missed that option!