Which is the command to query a Subversion repository for all files checked out to locked by a specific user?
views:
258answers:
4Which is the command to query a Subversion repository for all files locked by a specific user?
Do you mean to search for files locked by a specific user? Because you can't search for files checked out by a particular user (without raiding that user's home directory).
In subversion "checked out" merely means that you have made a local working copy of some folder in the repository. You can then work off-line on this working copy (until you need to do some operation that requires communication with the repository).
While off-line you could delete your working copy at any time, so there really is no way for the server to know who still has something "checked out" and who hasn't.
edit: So you meant locks. To list everything locked by a specific user, you can use a bit of svn+xml+xslt voodoo. First, create an svninfo.xml file like this:
svn info -R --xml http://url/to/project/root >> svninfo.xml
Add this xslt stylesheet pre-processor element in the result file after <?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="svnlocks.xsl" ?>
Create an svnlocks.xsl file with this content, replace username
by the actual username:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<html><body>
<xsl:apply-templates select="info/entry[lock/owner='username']" />
</body></html>
</xsl:template>
<xsl:template match="entry">
<xsl:value-of select="@path"/><br/>
</xsl:template>
</xsl:stylesheet>
Finally, open svninfo.xml with your favorite browser.
use svn status to get a listing of all files locked by a user - by that I mean, all files that have the svn:needs-lock property set, and a user has acquired those locks using the svn lock command.
If you're using the command line, you'll see an O marker on each file that is locked, run svn status --show-updates. To find out who has that file locked, use svn info. (note, if you have a file locked, svn status will show K).
If you're able to use svnadmin
on the repository machine, then you can use svnadmin lslocks <repo>
to get details of all locks held on that repository. From there, you could write something to filter by username.
See The Subversion Book: Advanced Locks (Breaking & Stealing Locks) for more information.