8

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 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?

Richard Ev
  • 52,939
  • 59
  • 191
  • 278

4 Answers4

13

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).

shunty
  • 3,699
  • 1
  • 22
  • 27
8

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.

pmod
  • 10,450
  • 1
  • 37
  • 50
  • This response best answers my question, however the get/release lock mechanism is pretty slow, since it recursively makes the change on all files. Therefore I am not sure we will actually use this approach. – Richard Ev Jul 30 '10 at 08:28
  • 2
    Right, we use svn repository in our work extensively and don't use locking. We have conventions on trunk/tags/branches, so nobody commits to tags; we make only bug fixes in release branch and the whole activity on project can be easily seen through WebSVN. – pmod Jul 30 '10 at 09:44
4

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.

Rudi
  • 19,366
  • 3
  • 55
  • 77
0

What we do is to move the branch over to a tag and only have readonly access to the tag.