Subversion Mac fix
Subversion is great for more than just simple backups.. it’ll let me know when files were edited, and which files were changed in each sync.
But Subversion was written for the land of *nix/Windows, where these obnoxious things called resource forks don’t exist, where Finder doesn’t auto-create files.
Hear ye, hear ye, I have created the solution.
Mac OS’ .DS_Store files: killed.
Mac OS’ ._blah files: killed.
KDE’s .directory files: killed.
Furthermore, this bash script will auto-update & commit too. Handy for an all-in-one’er. Now, I know, many of you out there are more subversion-knowledgeable, and use hooks for this, but this little beasty will solve already-present crap-files in a repository.
Hope it works for y’all. I’ve tested it against all my repos with lots of crazy characters.. all the quotes out there, etc.
Future improvements: I’m willing to hear about. (like perl regEx’ing svn’s errors to stop the script.. or one-control+c script-stopping)
#/bin/sh #################################################### ## Usage: ## sh thisscriptfilename.sh folder ## ## Config: change the value of 'export loc'. ## ## Issues handled: ## quotes in filenames: -print0 / xargs -0 ## spaces in filenames: -print0 / xargs -0 ## svn can't delete files not added: --force ## svn can't --force delete files in un-added folders: rm -f after svn --force delete #################################################### export loc="/Volumes/storage/" cd "$loc/$1" echo "Displaying status: $loc/$1" svn status . echo "Updating changes from server" svn update . echo "Cleaning up" ## no MacOS Resource forks! find "$loc/$1" \( ! -name .svn -o -prune \) -type f -iname "._*" -print0 | xargs -0 svn --force delete find "$loc/$1" \( ! -name .svn -o -prune \) -type f -iname "._*" -print0 | xargs -0 rm -f ## no KDE .directory! find "$loc/$1" \( ! -name .svn -o -prune \) -type f -iname ".directory" -print0 | xargs -0 svn --force delete find "$loc/$1" \( ! -name .svn -o -prune \) -type f -iname ".directory" -print0 | xargs -0 rm -f ## no .DS_Stores! find "$loc/$1" \( ! -name .svn -o -prune \) -type f -iname ".DS_Store" -print0 | xargs -0 svn --force delete find "$loc/$1" \( ! -name .svn -o -prune \) -type f -iname ".DS_Store" -print0 | xargs -0 rm -f ### test: ## find "$loc/$1" \( ! -name .svn -o -prune \) -type f -iname "._*" -print0 | xargs -0 ls -lsa echo "Adding.." svn --force add . echo "Status to send:" svn status . echo "Sending.." svn commit -m '' . echo "Final status:" svn status .