SVN 悲观锁 五步曲
In some case you need to force developers to always lock files on a project when they make changes. If this property is set the developers is forced to lock a file and then only he can make changes to that file. You will still have the functionality to steal locks when someone isn’t available to unlock a file.
Here is how you need to setup your SVN solution.
Step 1:
Go to the properties screen of your repository.
Step 2:
Click “New” to add a new property. Select “SVN:needs-lock” under Property Name. Give the following Property Value: “*”. This will set the property to all files in repository. Check the checkbox next to “Apply property recursively”. Click OK.
Step 3:
The property will now be set to all your files. You need to commit all the files for the change to take effect.
Step 4:
Next you need to set properties in the Subversion config file on each user’s local machine. This config file ensures that every new file that’s added to your repository, property ’svn:needs-lock’, is also set.
The config file will be in the following directory: “C:\Users\
Open the ‘config’ file in notepad:
Make sure your config file resembles the following:
“### Automatic properties are defined in the section ‘auto-props’.
enable-auto-props = yes
### Section for configuring automatic properties.
[auto-props]
*.* = svn:needs-lock = true”
Step 5:
Save the config file.