Using find in Subversion working copies

The POSIX find command is extremely convenient and powerful for searching out files and features of the filesystem. In combination with its -exec action it can make changes to many files based on nuanced characteristics. I can’t live without it.

However, it’s inconvenient to use find in Subversion working copies because of all the .svn folders. Find searches within all of them, and since they contain duplicates of the files in the working copy itself, things get cumbersome fast.

You can work around this by pruning .svn:

find . -name .svn -prune -o -print

but find’s -prune flag is pretty intricate and befuddles even the smartest administrators and developers from time-to-time, especially if you don’t understand the default action, -print.

To make this easier, I’ve written a shell function that automatically prunes “.svn” and anything found in the svn property “svn:ignore” in the target path. Feel free to use this if you find it convenient.

svnfind() {
	# find things in an svn working copy
	# excluding .svn dirs and anything
	# in the target directory's svn:ignores
	local ignores=()
	local IFS=$'\n'
	local path

	# GNU no-path compatibility
	case "$1" in
		-*) path=".";;
		*) path="$1"; shift;;

	set -f # turn off globbing temporarily
	local _ignores=( $(svn pg svn:ignore "$path") )
	for i in "${_ignores[@]}"; do
		ignores+=( -o -name "$i" )
	set +f

	# If find contains no "actions" other than -prune,
	# append the default action of -print
	local default="-print"
	for arg; do
		case "$arg" in
				unset default
	# $default must be unquoted here
	find "$path" \( -name .svn "${ignores[@]}" \) -prune -o "$@" $default

Sony, Hulu, and Net Neutrality

Neither Sony nor Hulu are Internet Service Providers, so you might wonder how they can be involved in the Net Neutrality dispute. Let me explain how they relate.

I purchased Hulu Plus today, with the understanding that a Hulu Plus membership is required in order to view Hulu-streamed content on my television via my Sony Playstation 3. (This is already a fair-use stretch for me, because I paid money for my Playstation, and think I should be able to use it like any other computer I own.) When I went to try to use it, I discovered that in addition to a Hulu Plus membership, you must also have a Playstation Plus membership to view the content from Hulu on a PS3.

“OK,” you might ask, “I see how that’s annoying, but what does it have to do with Net Neutrality?”

From Wikipedia, “The [Network neutrality] principle states that if a given user pays for a certain level of Internet access, and another user pays for the same level of access, then the two users should be able to connect to each other at the subscribed level of access.”

I’ve paid for my Hulu Plus membership. Hulu is providing the same level of access to people using other devices, but not to me. I would need to pay for an additional tier of access to receive that content on a device that I own. Keep in mind here, nobody is asking me to pay for software or hardware that makes my Playstation able to view content it would otherwise be unable to view. That would be fair. But my Playstation 3 is capable of playing content from Hulu. In fact, Playstations used to do that and were later blocked deliberately. Asking me to pay more for services available to others who are not paying more: that is unfair and should be illegal.

Reply to this rant on Twitter — @michaelasmith.