开发者

SVN: Is it possible get a file locked as soon as the user checkout the file from SVN repository?

I have a particular requirement. I want that as soon as the user checkouts a file, that file should get locked with the name of that user and then no other user should be able to checkout that file until the lock is released. I want to do this for a few binary files which cant be mer开发者_运维百科ged after simultaneous editing by various developers. There is a property called svn:needs-lock but it does not locks the file it only makes it read-only and does not allow to save the file after all the editing has been done which is a waste of both time and efforts. Is there a method through which i may be able to create a hook which gets triggered as soon as a checkout takes place. And in that hook I may lock the file so that no one else is able to edit it until I commit and the lock is released.


It's not possible to have a exlusive lock on a file only based on a checkout. What you can do is put the svn:needs-lock property on the file. The result is to have the file read-only in the working copy and a reminder to get a lock first before doing changes. Subversion works based on the "copy-modify-merge" model. The strickt locking paradigm is used by other versions control systems like ClearCase but not by Subversion.


You're going to have to use another version control system that uses exclusive locking. SVN isn't appropriate for the scenario you have in mind.


I suggest to write a script/program than runs when you try to open this type of files. The script would check whether the file is read-only (you don't use CD-disks often isn't it?). In this case it will lock the file (or show an error message) and launch the editor.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜