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

Re: unlocking a svn:needs-lock file

From: Johan Corveleyn <jcorvel_at_gmail.com>
Date: Fri, 27 Mar 2015 23:02:33 +0100

On Fri, Mar 27, 2015 at 5:04 PM, Andrew Schwartz <aschwartz_at_gmail.com> wrote:
> Hi,
>
> I'm using svn on Windows.
>
> If a file with the svn:needs-lock property is currently locked and is
> locally modified, I think that 'svn unlock' should fail. I'm seeing it
> happily succeed.

I see no problem with that. The svn:needs-lock property is merely a
suggestion for the client that it *should* lock the file when it
intends to edit it. A well behaving svn client will make such files
read-only on the filesystem, but not much more. Good tools that are
integrated with an svn client will automatically offer to take a lock
when you start editing a file. But if you make such a file writable
yourself (unchecking the read-only flag from the file's properties),
and edit it with Notepad, there is nothing stopping you, and svn can't
possibly intervene to take a lock.

> After the 'svn unlock', the local checkout is in a bad state: it has local
> modifications to an unlocked svn:needs-lock file.

That's not a bad state. It may be unusual, but it's not 'bad'. It's
the same as if you would edit the file directly with some editor,
outside of svn's knowledge.

Keep in mind though that you won't be able to commit your changes if
someone else has locked it.

> Is there a legitimate use case here that I'm not thinking of?

For instance, if you decide to unlock it for now (to give others the
opportunity to edit it from their working copies), but still want to
keep your local changes for a while (perhaps to make a backup of them
to come back to it later or whatever).

Maybe you keep your file locally modified (but unlocked for a while),
do some other stuff, and lock the file later shortly before you decide
to commit your changes anyway.

-- 
Johan
Received on 2015-03-27 23:03:22 CET

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

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