How do I do an exclusive checkout in SVN?

Oded picture Oded · Jul 26, 2009 · Viewed 17.3k times · Source

I'm looking for a way to make an exclusive checkout from SVN.

  1. Is there a way to automatically lock a file when it's being checked out ?

  2. If one user makes an exclusive checkout, and then another user makes a checkout to the same file, how do I generate some sort of notification or an instant message to the 2nd user that the file is locked?

Answer

Alex picture Alex · Jul 26, 2009

You can add the property or auto-prop svn:needs-lock which makes the file read-only and requires you to place a lock on the file to edit it.

If you are using TortoiseSVN you will see a different icon for locked files, this should be easy for a second user to see and know not to edit the file.

Referenced in TortoiseSVN documentation