Locking a SubVersion branch in the days before a release
In the days before a release we'd like to be able to prevent developers from committing files to the SubVersion branch, unless a team leader has reviewed and开发者_JS百科 approved the changes (in which case they would make a temporary change to allow this).
Previously we used ClearCase, in which this was relatively easy to do.
Since the svn:lock command only works on a per-file basis, we are uncertain if we can emulate this behaviour in SubVersion.
What do you do?
Laterally thinking - why not just create a branch at the point at which you want to 'lock' it and only check out that revision number in your build/release process.
Then developers can still check-in to the trunk (or whatever other branch they're working on) and if a team leader approves changes for the release then they can be merged into the branch. Granted this doesn't actually 'lock' the release branch but at least you can easily track/undo changes if necessary and it doesn't prevent people working. The developers source will still be pointing to the branch/trunk they were working on rather than the new release branch.
Creating branches is very cheap and easy in SVN (I believe).
You can have a look at GUI svn clients which usually have richer interface/functionality set than a command line one. For example, I'm using TortoiseSVN which has options Get Lock/Release Lock applicable for locking all files in the selected folder recursively. BTW, it also has convenient option of making tag/branch and switching to it as one action.
You can add a pre-commit hook on the server, which checks if the commit target contains closed branches, and maybe a keyword in the log message to bypass this check.
What we do is to move the branch over to a tag and only have readonly access to the tag.
精彩评论