29

We have some files in our project that can't be merged and hence the files must be locked by the users before editing them. Is there a way to force the user to lock a file before editing?

We are using Subversion and TortoiseSVN / VisualSVN.

bahrep
  • 29,961
  • 12
  • 103
  • 150
Zooking
  • 3,491
  • 4
  • 34
  • 39
  • As others have stated, you can use the `svn:needs-lock` property on those files. You can use a pre-commit hook to require that these files have locks. You can also install a pre-unlock hook to prevent users from stealing locks. Usually, this isn't necessary. – David W. Jan 17 '14 at 00:48

2 Answers2

49

Two steps:

  • put the svn:needs-lock property on those files. That way they are check out read-only
  • when such a file must be modified, use the svn lock command and commit as usual

links:

GEOCHET
  • 21,119
  • 15
  • 74
  • 98
cadrian
  • 7,332
  • 2
  • 33
  • 42
18

More specifically, if you have TortoiseSVN installed,

  1. Right-click the file in Windows Explorer, select TortoiseSVN->Properties
  2. Click New->NeedsLock
  3. Choose Locking required in the dialog:
  4. Click OK
  5. Commit the file
  6. Done!
Godsmith
  • 2,492
  • 30
  • 26