2011-12-01 86 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