2011-12-01 41 views

回答

1

您可以使用svn lock,但其他用户可以强制锁定。最好的方法是使用一个将拒绝修改文件的钩子。

这些文章应该让你去:

+0

感谢您的信息。看来这是要走的路。我给你+1了,但詹姆斯先给了同样的答案,所以接受了他。 – Firedragon

0

我想答案是肯定的,没有两个。是的,从这个意义上说,你可以lock该文件,从来没有unlock其他用户。没有在这个意义上说,如果你unlock该文件,另一个用户可以modify它。它取决于你找到正确答案的选择。

2

我看到你已经接受了一个答案,但是我有一个Perl pre-commit hook可以做你想做的。所有你需要做的就是发送在控制文件中的条目:

[file You are not allowed to modify this file] 
file = /the/file/you/cannot/modify.txt 
access = read-only 
users = @ALL 

顺便说一句,你应该创建一个管理员组的成员可以修改这些文件,所以您不必如果你改变了钩必须修改它:

; Creates a group of users who are allowed to modify read-only files 
[group admins] 
users = firedragon, bob, ted, carol, alice 

[file Only Admins are allowed to modify this file] 
file = /the/file/you/cannot/modify.txt 
access = read-only 
users = @ALL 

; Order is important. The last entry that matches 
; the file is the one implemented 
[file Only Admins are allowed to modify this file] 
file = /the/file/you/cannot/modify.txt 
access = read-write 
users = @admins 

您可以指定一组使用Ant风格的水珠或Perl的正则表达式的文件,以及访问控制可以read-writeread-onlyno-delete,或add-only这是伟大的标签。用户可以创建一个标签,但不能对其进行修改。

[file You can create a tag, but not modify it] 
file = /tags/** 
access = read-only 
users = @ALL 

[file You can create a tag, but not modify it] 
file = /tags/*/ 
access = add-only 
users = @ALL 

第一个删除在整个标记目录树中的任何位置写入的所有功能。第二个允许用户只在/tags/目录下直接添加标签。

顺便说一句,你应该创建一个可以修改这些文件的管理员组的成员,所以你不必改变钩,如果你这样做:

+0

意见新的评论。我已经标记了你,希望我能做更多: - / – Firedragon

相关问题