Random Stuff About Stuff

SVN remove all the locks in a directory

December 04, 2015

I was archiving old projects as we are moving to from svn to git. But I keep coming across old locks, sometimes very old - the developer had left.

It was proving a bit of a pain finding each of the files and unlocking them. I also didn’t want to checkout all the repos involved.

The way I ended up doing it requires access to the svn server

sudo svnadmin lslocks /svnrepos/ | grep '^Path: /Web' | cut -c 7- > locks

sudo cat locks | xargs -d \\n sudo svnadmin rmlocks /svnrepos/

So find all the locks in under a path.

Then pipe them to the unlock command.


Written by David Kerwick who lives and works Dublin as a Java Technical Lead.