neverpanic.de

Subversion Property Copy

| Comments

Although there are a couple of Subversion GUIs for Macs, I usually use the command line interface. I manage all source code I write during my studies using Subversion and usually add revision number and date of last checkin to the file using the svn:keywords-Property. However, I always forget the set of keywords I usually add: Author Date Id Revision URL. Unfortunately, there is no way to copy a property from one file to another in the standard subversion binary. There is, however, a little shortcut:

svn propset $propertyName "`svn propget $propertyName $fromFileName`" $toFileName

Typing this monster isn’t any userfriendly at all, though – a little .bashrc magic does the trick:

# add svn propcopy
function svn() {
	case "$1" in
		pc|propcopy)
			propName=$2
			fromFile=$3
			shift 3
			`which svn` propset $propName "`\`which svn\` propget $propName $fromFile`" $@
		;;
		*)
			`which svn` $@
		;;
	esac
}

Update

Thanks to Raim for the wildcard support. Using subversion auto-props is an option for files, but unfortunately, auto-props don’t work on directories yet.

Comments

Please enable JavaScript to view comments. Note that comments are provided by a local instance of Isso. No data is sent to third party servers. For more information, see the privacy policy.