svn_apply_autoprops.py

Subversion includes a contrib script svn_apply_autoprops.py that scans your auto-props settings and applies them to a working copy. These are normally applied to files you add to the repository, but this script is useful if you have added new properties, or other users have added files without configuring the desired properties. However, since I use SVK this script didn't work for me. I looked at the script to see if I could convert it to use SVK instead, but it was relying on the .svn folders to try to determine what directories to scan and I didn't like the fact that they were parsing the config by hand with regular expressions instead of using the extremely useful ConfigParser module.

I decided it would be quicker to rewrite the script than to fix up the existing one, so here is the new and improved version: svn_apply_autoprops.py

Key features include:

Faster

This version is about twice as fast as the old one on the several repositories I've tested. The old version walked the directory structure for each pattern to find matching files. This version uses svn status -v to find all the versioned files once and simply scans this list to find the matching files.

Simpler

Using the ConfigParser and simplifying the directory scanning made this new version about 1/2 the code of the old one.

SVK support

There's a variable that is defined at the top of the script to determine which command is used: svn or svk. Both support the same arguments needed by this script and are easily interchangeable.