Question

I'm trying to find a way to remove zombie locks using the Subversion command line tools. The eventual goal is to do this from a hook script, but I haven't been able to work out the command line to use when you only have a physical repository path. (Using svnadmin rmlocks only seems to work for locks which exist in the HEAD revision.)

Ideally, I'd like to do this via the post-commit hook script using the command line tools. (I'm aware of the python script for this purpose, but we'd prefer not to install python on that server for this single use.) We're a .NET shop, so creating a tool with the SharpSVN library is also a possibility, but the only unlock capability there appears to be in the SVNClient class.

So it's really two questions: Is there a way to do this with the command line tools? If not, is there a way to do it from SharpSVN? (Or perhaps another library?)

== Update Dec 3, 2012 ==

I've had to revisit this problem recently and discovered this question is still drawing traffic. The python script mentioned in the original question and Don's answer has since moved to: http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/remove-zombie-locks.py (I assume that's what most folks are looking for.)

Ironically, even though the repository has moved to Linux, we're using the C solution.

Was it helpful?

Solution 2

It looks like the answer is "You can't get there from here."

  • Svnadmin provides a command-line for removing locks with a repository path, but it doesn't seem to work with zombie locks.
  • SharpSVN is primarily client-side; it does have a few methods for connecting with a repository path, but those (per the docs) are mostly for use in the library's unit tests.

So rewriting the python script in C using the Subversion API library.

OTHER TIPS

There's a Python script (referenced here: http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2369399). I'd either use that, or translate it to .NET if you needed to.

If you know the repository path to the deleted file that is zombie-locked, it is so simple that I couldn't believe it at first:

svn unlock --force https://path/to/my/file

This works even though the deleted file does (by definition) not exist in the repository's head. No peg revision required nor allowed. The force option is only necessary if the lock is from another user.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top