#!/bin/bash # svn-ignorer © 2006 Joachim Breitner # # Comments to mail@joachim-breitner.de # # 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. # Check by Martin Süßkraut if [ -z "$EDITOR" ]; then echo "ERROR: \$EDITOR not set, `basename $0` can not run" exit 1 fi listfile=$(tempfile) echo "# Delete all file that should _not_ be ignored" >> $listfile echo "# You can add wildcard patterns as you wish" >> $listfile echo "# Note that ignore patterns are added, not overwritten" >> $listfile echo >> $listfile svn status|grep '^?'|cut -c8- >> $listfile $EDITOR $listfile dirsfile=$(tempfile) # Extracting directories grep '^[^#]' $listfile| while read do echo $(dirname "$REPLY") done | uniq > $dirsfile ignorefile=$(tempfile) while read do dir="$REPLY" echo "Setting ignores for $dir" svn propget svn:ignore "$dir" > $ignorefile pat=$dir [ "$pat" = "." ] && pat="[^/#][^/]*$" grep "^$pat" $listfile | while read do echo "$(basename "$REPLY")" done | grep -vE '^$' | sort -u >> $ignorefile svn propset -q svn:ignore -F $ignorefile "$dir" done < $dirsfile rm $listfile $dirsfile $ignorefile