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

Managing "needs-lock" files on multiple branches

From: Benjamin Fritz <fritzophrenic_at_gmail.com>
Date: Thu, 13 Jun 2013 14:41:13 -0500

Where I work, we branch for every bugfix, to allow a "clean" trunk at all times.

Some files we work with are not easily merged, so we have
svn:needs-lock set on them.

Locking one of these files is supposed to indicate to the rest of the
team not to touch it until you're done (or at least, ask first). But
since the lock is on a branch, somebody else on a different branch, or
even merging back to trunk, will have no way to know you are editing
the file.

I wanted to solve this using a pre-lock hook on the server, which
would automatically try to lock the trunk version of an artifact when
somebody locks on a branch. But, since locking requires a username and
password, and hook scripts do not have access to that information, the
best I could do is deny the lock if the trunk is not locked, and also
if the existing trunk lock does not contain the branch name in the
lock comment.

I might be able to get a special user added, with a password that
never expires, which the hook script could use with a hard-coded
password to create the trunk lock.

Is there a nicer way to create a trunk lock from the hook script? I
don't know if "the powers that be" will approve of a special user for
this purpose. Or perhaps an alternate solution to allow branch locks
to actually be useful? I sold the team on a pre-lock hook in the first
place with the idea that it could be fully automated, I'll need to
sell them again if there is an extra manual step in there.

Most of us use the TortoiseSVN GUI rather than command-line tools, so
a simple wrapper script to invoke instead of using "svn lock" directly
isn't a very nice option either.
Received on 2013-06-13 21:46:41 CEST

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.