Hi I was wondering if there is a way for the SVN server to automatically assign the svn:needs-lock property on any file that is binary and not textual.
We have a rather small developers team but resting on everyone to remember to set this property on newly created binary files doesn't make sense since it's very easy to forget such a thing.
It should be noted that the auto props method has to be configured on each SVN client being used. So when you're setting up a new developer, or an existing developer on a new machine, you have to remember to perform this configuration.
If you are all using TortoiseSVN, you can set the tsvn:autoprops property on the base folder of each checkout and it will be honoured by all TortoiseSVN clients.
If you really want to nail it, you'll need to put a pre-commit hook in each repository. The enforcer script might be easily tooled for this.
If you have any python-fu, RepoGuard (the successor to SVNChecker) looks like it could be useful too.
No matter which you pick, there's no way to retroactively apply the property to existing files in the repository, I think. You can probably enforce it on the next commit of the file, however.
Edit the svn config file and add an entry for auto props or use
svn:auto-props
versioned property with SVN 1.8 and newer clients. Read SVNBook!EDIT:
From SVN 1.8 the you can apply the
svn:auto-props
property to the root path of your repository. See this release note and updated SVNBook 1.8 chapter.There's a page on this Subversion wiki that describes all the different options on how to automatically add needs-lock and how to guarantee it has been set. The page also gives example scripts and configuration details:
http://www.orcaware.com/svn/wiki/Automatic_lock-modify-unlock
Use a pre-commit hook
and a pre-lock hook
Apache Subversion 1.8 introduced the Repository Dictated Configuration feature which requires SVN 1.8 client, but 1.8 server is not necessary because this is a client-side feature.
With Subversion 1.8, you can configure auto-props patterns within a repository using the new Subversion
svn:auto-props
inherited property.For example, set
svn:auto-props
value to*.exe = svn:needs-lock=*
property on the root of your repository (or repository path that represents a root of a project). This will result into each newly added *.exe file havingsvn:needs-lock=*
property applied.You can store multi-line values in Subversion properties, so you can add the following standard svn:needs-lock and MIME pattern to
svn:auto-props
: