Joachim Breitner

little subversion helper script: svn-ignorer

Published 2006-05-27 in sections English, Digital World.

Hi subversion-using world. I always had the problem that setting svn:ignores is quite tedious, especially since svn refuses to read the list from standard input, and specifying multiple line values on the command line is not very convenient. So I wrote a little shell script, here is the usage:

Usage: Just run in your svn directory. It will fire up your favourite $EDITOR and lets you edit the list of files unknown to subversion. Erase those that you don't want to ignore, and add wildcard patterns at will. When you close the editor, the files left in the list will be added as svn:ignore properties to their directories, amending the present list of svn:ignores

If you think this of any use to you, grab it here. Comments welcome.

Comments

As pointed out to me by Brett Parker, how is this different from:
svn propedit svn:ignore .
#1 JD (Homepage) am 2006-05-27
I was thinking the same thing as I always use propedit, but it looks like Joachim's script preseeds your editor with all files in your working copy currently unknown to subversion.
#2 Martijn Vermaat (Homepage) am 2006-05-27
Yeah, I did wonder that after I'd read it again after commenting. If you use vim as your editor you could do something like

:r !svn status -N | awk '/^\?/ { print $2}'

map that to a function or something.
#3 JD (Homepage) am 2006-05-27
Right, it gives you a list of things you proably want to ignore (in my case, the various .aux, .log, and .pdf files from LaTeX). But the bigger advantage is that this script works across directories, and feeds the entries to the correct subdirectories. (AFAIK svn:ignore entries are _not_ recursive)
#4 Joachim Breitner (Homepage) am 2006-05-27
You should add a check for an empty $EDITOR. Otherwise your script sets all new files to the ignore list. The check can look like:

if [ "$EDITOR" == "" ]; then
echo "ERROR: \$EDITOR not set, `basename $0` can not run"
exit 1
fi
#5 Martin Süßkraut am 2006-09-01
Thanks, is added.
#6 Joachim Breitner (Homepage) am 2006-09-03

Have something to say? You can post a comment by sending an e-Mail to me at <mail@joachim-breitner.de>, and I will include it here.