Today I came across a persistent problem while trying to reintegrate a feature branch into the trunk of one of our software projects.
The problem presented itself as an error message while trying to commit the trunk which had the branch merged into it. The error message read:
svn: Cannot verify lock on path ‘/some_file_name’; no matching lock-token available
This is quite an ordinary error message which basically says that SVN has failed to lock a file (most likely due to the fact that the file is locked somewhere else).
After fumbling around a little bit, locking all the files in trunk, trying again after getting a fresh working copy of the trunk – I was still stuck with the same error.
I sat back and after reading the error message again I noticed something strange: the file which was mentioned did actually not exist in the HEAD of our trunk anymore! It had been deleted back in last September.
Now, that’s something curious – how can my check-in fail because of a non-existent file being locked?
After googling around a bit I came across the solution: it’s a bug not a feature!
Now, when you’re running SVN on a Windows OS like we do you’re in for a bit of a ride. I tried to install Python 2.7.1 and the SVN python bindings to make the script run but I just couldn’t. I ended up copying the repository to a USB thumb-drive and running the script on the repository back at home where I have a Ubuntu linux PC.
I would recommend you to do the same, it’s a lot easier than trying to make it work on Windows Server.
Installing Subversion and the python bindings is very easy in Ubuntu linux:
sudo apt-get install subversion python-subversion
Now that you’ve installed Subversion and the bindings it’s easy as pie to get rid of those nasty “zombie-locks”:
python remove-zombie-locks.py /path/to/your/repository all
Instead of specifying “all” on the command line you may also use the revision number up to which you’d like to remove “zombie-locks”.
That’s it, you’re done and the “zombie-locks” are gone!
Pay attention to these points and you should be fine:
- You need to stop your SVN server before performing any operations on your repository.
- Make sure your linux computer runs the same major SVN version as your Windows Server, e.g. 1.6.x
- If the script returns with an exception quoting a “FS Error” you’re most likely to have a version mismatch, see above
- Make sure you’ve got a backup copy handy, just in case.