[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: How to find out if I own a lock?

From: SteveKing <steveking_at_gmx.ch>
Date: 2005-04-13 19:34:47 CEST

Ben Collins-Sussman wrote:

>> I was wondering if there's an easy way to find out if a lock on a file
>> is owned by the one owning the working copy (i.e. if the file isn't
>> readonly but has a lock owner assigned to it).
>
>
> svn_client_info() returns an svn_lock_t inside the svn_info_t
> structure. If a lock-token is attached to the working-copy file, then
> information about the lock is in that svn_lock_t structure. Does that
> help?

Not really. The svn_wc_entry_t structure already contains that
information. But that's not what I'm looking for.

Seems I didn't read the locking notes enough. I thought that when doing
'svn up' the lock information is stored in the wc (so the user can see
which files are locked by which user). But as I just tested with
file:/// that's not the case.

So to check if I got it right this time:
- if the svn_lock_t structure is filled in in a working copy, *that*
working copy owns the lock.
- if someone else has a file locked, it's not possible without
contacting the repository to find that out (updates don't update that
information in the wc - that's not stored in the wc at all).

So now my request for an enhancement to the svn_wc_entry_t struct: a
boolean value indicating that an entry is readonly. Since
svn_client_status2() already opens those files to check the filedates,
that information is 'for free'. Otherwise I have to do a filestat call
for every file again, which is very bad (performance wise).

The svn:needs-lock property doesn't help here either:
- it takes even more time to read that property than to check the
readonly flag of a file
- the property is there even if the working copy itself has the lock

Stefan

-- 
        ___
   oo  // \\      "De Chelonian Mobile"
  (_,\/ \_/ \     TortoiseSVN
    \ \_/_\_/>    The coolest Interface to (Sub)Version Control
    /_/   \_\     http://tortoisesvn.tigris.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Apr 13 19:35:43 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.