views:

387

answers:

1

My company's svn repo has a lot of MS Word docs in it. We've implemented a policy that all .doc files must have the svn:needs-lock property set to prevent parallel access on files that are hard to merge (we've also done this for xls, ppt, pdf etc.).

We've implemented the policy by distributing a svn config with auto-props set appropriately for all relevant document types. We've also set up a pre-commit hook that checks that all added files of these types have the needs-lock property set (i.e. if they forget/are too lazy to update their svn config file, they won't be able to add any docs to the repo).

The problem I'm having, however, is that the pre-commit hook fails when users try to import files into the repo, e.g. some users like to add files directly thru TortoiseSVN's Repo Browser, which effectively is an svn import.

Through testing on other file types, I have seen that doing an import does in fact apply the auto-props listed in my config, but they don't seem to be applied at the point that the pre-commit hook runs. When importing .doc files, the hook fails, saying that the needs-lock property is missing.

Is there really much difference between adding a single file to a working copy and committing it vs importing a file directly? Do we need to tailor our precommit hook in some way to cater for this scenario?

A: 

Solved it...my fault too.

The autoprops were defined incorrectly. I had entries such as:

*.doc = svn:needs-lock

when I should have had:

*.doc = svn:needs-lock=*

i.e. actually set a value for the needs-lock property, as you would for any other property like svn:mime-type.

The irritating issue is that the broken config works just fine for add operations. It doesn't seem to matter that the "=*" is missing from the end of the autoprops definition. The * value of the property appears to get set anyway.

When you do an import, however, Subversion isn't as nice and doesn't fix your borked autoprops setting automatically.

I accept that this was my fault, but the behaviour should be consistent across both add and import operations.

James Tisato