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:



rm -f ${TMPFILE}

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

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

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


Anonymous said...

Something like this, and many many more cool scripts can also be found in KDE svn under this dir (in svn) ssh://



Pier Luigi Fiorini said...

why not svn propedit?

K. Walter said...

More SVN tricks + scripts here:

Egon Willighagen said...

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