Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to see what files are locked in Subversion?

I finally got my group to switch from SourceSafe to Subversion. Unfortunately, my manager still wants to use exclusive locks on every single file. So I set the svn:needs-lock property on every file and created a pre-commit hook to make sure the property stays set.

We are running Subversion on a Linux server. Most of us use Windows machines and a few use Macs. We are using various SVN clients (TortoiseSVN, SmartSVN, Subclipse, etc.).

What we now need is a good/easy method to see all the files that are currently locked in the entire repository (and who has them locked). I have poked around a little in Tortoise and Subclipse, but haven't found what I am looking for. Our projects have many subdirectories that are multiple levels deep, so it would be too time consuming to look at each individual directory.

What I would like is a single report I can run that lists everything that is currently locked and who has it locked. What is the best way to get this type of information?

like image 211
Shane Avatar asked Nov 12 '08 18:11

Shane


People also ask

How do I view svn files?

To find information about the history of a file or directory, use the svn log command. svn log will provide you with a record of who made changes to a file or directory, at what revision it changed, the time and date of that revision, and, if it was provided, the log message that accompanied the commit.

How can you tell if a file is locked in Linux?

Finding the locked files In order to view all locked files on the current system, simply execute lslk(8) . In this document as an example, we will find and remove a locked file from a KDE session on a shared storage, where multiple clients are mounting their home partitions from an NFS server.

What is lock in svn?

Name. svn lock — Lock working copy paths or URLs in the repository so that no other user can commit changes to them.

How do I find svn modified files?

To get an overview of your changes, use the svn status command. You may use svn status more than any other Subversion command. If you run svn status at the top of your working copy with no arguments, it detects all file and tree changes you've made.


2 Answers

What you're looking for is the svnadmin lslocks command.

I have this set up at work because we keep some Word documents in our Subversion repository (with svn:needs-lock). I have a cron job set up that every day, checks the list of locks and emails a report of all locks older than 7 days to the whole team. That way we can tell who has been slacking and sitting on a locked copy of a document for a long time.

like image 83
Greg Hewgill Avatar answered Sep 22 '22 12:09

Greg Hewgill


This might not be the answer you're looking for, but you should try to convince the manager that locks are actually not the best development practice. There's lots out there that's been written on this subject, so I won't repeat it all here.

When you go from a locking environment to one with no enforced checkout locks, at first you think it will lead to chaos, but it really doesn't. SVN is good at merging changes when two people are working on the same file, and even if you end up with conflicts, it's not so bad to fix them.

Much better than waiting around for the guy who went to lunch with a critical file checked out, or worse yet, went on vacation.

like image 40
Eric Z Beard Avatar answered Sep 21 '22 12:09

Eric Z Beard