Locking a File—Subversion

When you are working, you may want to lock the files you have modified. Locking a file does not prevent other users from modifying the file. However, no one else can commit a file that you have locked unless they steal the lock from you or until you remove the lock. See Unlocking a File—Subversion.

You can steal a lock from another user if you need to commit the locked file while they are working on it. Likewise, another user can steal a lock on a file you have locked.

How to Lock a File

  1. In the Source Control Explorer or File List, select the relevant file(s).

    OR

    Open a file.

  2. Do one of the following, depending on the part of the user interface you are using:
    • Ribbon Select Source Control > Lock.

    • Right-Click In the File List, right-click the files you want to lock and select Source Control > Lock.
    • Source Control Explorer Right-click the files you want to lock and select Lock.

    The Lock dialog opens. The selected files are listed with check boxes next to them.

  3. (Optional) In the Comment field, enter an optional comment tied to the submit. This enables you to keep an audit trail for a file. The comment can then be viewed from the History dialog, which can be accessed from the Source Control Explorer, the Source Control ribbon, or the Source Control button .
  4. (Optional) If you want to steal another user's lock so you can commit the file while they are working on it, select Steal the Lock. This will give you the lock so you can commit the file.

  5. Make sure to select the check box next to each file you want to lock so it contains a check mark.
  6. Click Lock..

Note You cannot lock files with Rename status.

Note Subversion will automatically lock a modified file when saving changes (if it is not already locked) if you selected the option to automatically check out files from source control when saving them. Because there is not a "checked out" status for Subversion files, these files will be marked as modified and can be committed.