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 one of the window panes (e.g., Content Explorer, Source Control Explorer, File List, Project Organizer, Pending Changes window pane), 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 If you have the Content Explorer, Project Organizer, Pending Changes window pane, or File List open, 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, the File menu, or the Source Control button Source Control drop-down 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 Add or 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 Source Control Checked Out icon and can be committed. See Options Dialog.