Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVN frequently says file is locked by me in another working copy

I have an SVN repository (hosted on Dreamhost) with needs-lock set on binary files. It sometimes happen that, while committing files locked and modified by me, the commit fails with the error:

Error: Commit failed (details follow):
Error: File '/my/file.bin' is locked in
Error:  another working copy

If I try to get the lock on that file (without stealing it) it says:

Error: Path '/my/file.bin' is already locked by user
Error:  'my_username' in filesystem '/home/user1/svn/repo1/db'

Cleanup doesn't help, so the only way to solve this is to steal the lock, and then the commit succeedes.

This is not a critical issue, but it is really annoying, especially when it happens in the middle of a long commit. I am inclined to think that this is caused by a bug of the client or the server, since I am sure that I'm not using other working copies, and the issue happens fairly frequently (3 times in the last two days) to me and my colleagues using the repository.

We are using TortoiseSVN 1.8.4, while the Dreamhost svn server is 1.6.12.

Thanks for any help.

UPDATE: I noticed that the error happens if I do an update of my working copy before committing (which gives no error and of course does not modify the locked files). By checking the status of the file, before the update tortoise says it is locked by me (checking only locally), while after the update checking locally it gives "????" as locking state, and by checking the server it then says it is locked by me. After the update the file is made read-only (because of the needs-lock), even if it is still marked as modified. So the sequence of actions is: lock file.bin -> modify file.bin -> update the whole working copy -> commit -> commit failed error. After the update the working copy seems to forget the state of the lock, and when it asks the server it believes it is locked on another working copy.

like image 275
cmant Avatar asked Feb 18 '14 18:02

cmant


People also ask

How do you break the lock in TortoiseSVN?

To release a lock manually, select the file(s) in your working copy for which you want to release the lock, then select the command TortoiseSVN → Release Lock There is nothing further to enter so TortoiseSVN will contact the repository and release the locks.

What is SVN working copy?

A Subversion working copy is your own private working area, which looks like any other ordinary directory on your system. It contains a COPY of those files which you will have been editing on the website.


2 Answers

On Windows, I fixed the problem by the following steps: 1. Launch Repository Browser by clicking "Repo-browser" in the menu. 2. Locate the locked file. 3. Right click your mouse on the locked file. 4. Click "break lock".

like image 87
Toby Han Avatar answered Sep 27 '22 19:09

Toby Han


If using a JetBrains IDE:

right click on the file you want to unlock, go to Subversion and click lock

then select checkbox steal existing lock and apply with OK

right click on that file again, go to Subversion and click unlock

If using command line:

lock the file with --force

svn lock --force path/to/file.ext

and unlock it again

svn unlock path/to/file.ext
like image 38
klausf Avatar answered Sep 27 '22 20:09

klausf